@grandlinex/bundle-multilang
v1.0.2
Published
> Multilang support for GrandLineX
Downloads
59
Maintainers
Readme
GrandLineX Multilang Bundle
Multilang support for GrandLineX
Description
GrandLineX is an out-of-the-box server framework.
Status
Issues
Store Variables
| Key | Description | |-----|-----------------------------------| | GLX_TRANSLATION_PATH | Path to translation *.json files |
Install
Example
class TestKernel extends CoreKernel<any> {
constructor(appName:string, appCode:string) {
super( { appName, appCode});
// ...
/**
* optional set the root path for translations
* -> alternatively you can pass the path in .env file GLX_TRANSLATION_PATH=$PATH
*/
const pathToTranslation=""; // Set path to folder containing translation files
const store = this.getConfigStore();
store.set(LangClient.STORE_TRANSLATION_PATH,pathToTranslation)
const defaultLangKey="en"; // Set the default lang key
this.addModule(new LangModule(this,defaultLangKey));
}
}
Translation format
File naming $key-$name.json like en-English.json or de-German.json
{
"test.key.first": "helloWorldEn",
"test.key.second": "helloWorld2En"
}