Multilang support for GrandLineX
GrandLineX is an out-of-the-box server framework.
Key | Description |
---|---|
GLX_TRANSLATION_PATH | Path to translation *.json files |
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));
}
}
File naming $key-$name.json like en-English.json or de-German.json
{
"test.key.first": "helloWorldEn",
"test.key.second": "helloWorld2En"
}