Open
Description
openedon Apr 7, 2024
With the i18n packages upgrade, our current pseudo locale implementation is very limited and has obvious drawbacks:
- Only
en-xa
is supported from the psuedo locale suite. - Runtime check at the react
Provider
level checking if the language isen-xa
- Will break with the newly supported ICU syntax, needs to update the regexp
The new formatJS library support psuedo localization at 'compile' time. Where a new psuedo localized translation file is generated and supplied to kibana like other languages.
If we switch from switching alphabets at runtime to this static file we gain multiple benefits:
- Remove our custom implementation
- No more runtime check in production for a dev only feature.
- Support all ICU syntax supported by formatJS
- Supports all psuedo localizations:
locale | description |
---|---|
xx-LS | my name is {name}SSSSSSSSSSSSSSSSSSSSSSSSS |
xx-AC | MY NAME IS {name} |
xx-HA | [javascript]my name is {name} |
en-XA | [ḿẏ ƞȧȧḿḗḗ īş {name}] |
en-XB | ɯʎ uɐɯǝ ıs {name} |
The new work flow runs as follows:
- Extract pseudo localized version of the code by running:
node scripts/i18n_pseudo --pseudo-locale <pseudoLocale>
- Running kibana with the created pseudo locale
yarn start --i18n.locale="en-xa"
Note that the extracted psuedo locales are git ignored and must be generated when needed, this is to guarantee that we are have full messages coverage everytime.
We can also run this script when yarn start
is called and the locale is set to a pseudo locale so people who need this will not need to run the new extra step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment