Skip to content

GrandlineX/bundle-multilang

Repository files navigation

GrandLineX Multilang Bundle

Multilang support for GrandLineX

Description

img

GrandLineX is an out-of-the-box server framework.

GitHub NPM TS

Status

Quality Gate Status Security Rating Maintainability Rating Reliability Rating Coverage

Issues

Bugs Vulnerabilities Code Smells

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"
}

Documentation