Skip to content

[i18n][system upgrade] Change pseudolocale implementation #180244

Open

Description

With the i18n packages upgrade, our current pseudo locale implementation is very limited and has obvious drawbacks:

  1. Only en-xa is supported from the psuedo locale suite.
  2. Runtime check at the react Provider level checking if the language is en-xa
  3. 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:

  1. Remove our custom implementation
  2. No more runtime check in production for a dev only feature.
  3. Support all ICU syntax supported by formatJS
  4. 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:

  1. Extract pseudo localized version of the code by running: node scripts/i18n_pseudo --pseudo-locale <pseudoLocale>
  2. 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

Metadata

Assignees

No one assigned

    Labels

    Project:i18nTeam:CoreCore services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions