0.3.0 • Published 5 years ago

multilang-label-manager v0.3.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Installation

npm i multilang-label-manager

Usage

Create a global variable that you can use throughout the project. You must pass the request of the server as a parameter.

global.LabelManager = require("multilang-label-manager")(request);

Now you can adding your languages using the addLanguages(args) command, and add new labels using the addLabels(args) command.

global.LabelManager.addLanguages("cn", "es", "it");
global.LabelManager.addLabels({
    "cn": {
        "welcome": "欢迎"
    },
    "es": {
        "welcome": "bienvenida"
    },
    "it": {
        "welcome": "benvenuto"
    }
});

The defalt language is en to set new language as default use the command:

global.LabelManager.setDefaultLang("es");