Application Localizer
Application Localizer package that helps with localizing applications
Pseudo Locale Generator Web Site
uses Intl MessageFormat Parser that parses ICU Message strings into an AST.
tested with Intl MessageFormat that formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.
used by vscode-app-localizer vscode extension
Features
- Locale validator - Check for missing labels - Multi-file locale support (see example below) _ Polymer file structure _ Angular flat file structure
- Pseudo locale generator (char mapping is taken from pseudolocalization-tool)
- Accents on letters
- Longer sentence
- Longer word
- Right-to-Left
- Enclose in exclamations
- Enclose in brackets - Support ICU Message syntax
- Cross-platform
Install
npm install app-localizer
API Reference
Pseudo locale generator options
- expander Sentence expand factor 0.3 = 30%
- wordexpander Word expand factor 0.5 = 50%
- brackets Enclose sentence in brackets
- exclamations Enclose sentence in exclamations
- accents Convert letter to its accent version
- rightToLeft RTL writing systems
- forceException Force throwing syntax exception if any
Locale validator options
- filePathPattern Locale files path (supports node glob pattern)
- multiFile Each locale is in separate file in the same folder
- fileStructure Structure of locale file content (
polymer
orangular.flat
file structure)
Usage
Locale validator
Validate locale file(s) (e.g. gulp
)
const gulp = ;const localizer = ; gulp; gulp;
Pseudo locale generator
Generate pseudo locale json file from source (gulp
)
const gulp = ;const localizer = ;const rename = ; gulp;
Generate pseudo locale json file from source (grunt
)
const localizer = ; module { grunt; grunt;};
Generate pseudo pseudo text (browser
)
npm install intl-messageformat-parsernpm install app-localizer
Generate pseudo locale text (try it)
transforms
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz|~
into
¡″♯€‰⅋´{}⁎⁺،‐·⁄⓪①②③④⑤⑥⑦⑧⑨∶⁏≤≂≥¿՞ÅƁÇÐÉƑĜĤÎĴĶĻṀÑÖÞǪŔŠŢÛṼŴẊÝŽ⁅∖⁆˄‿‵åƀçðéƒĝĥîĵķļɱñöþǫŕšţûṽŵẋýž¦˞
const localizer = ; const pseudoText = localizer;
Single-File locale example
/locales/locale.json
file with locales
Multi-File locale example
locale files should be in the same folder
/locales/en-us.json
(polymer file structure)
file with en-us locale
/locales/fr.locale.json
(angular flat file structure)
file with fr locale