0.2.8 • Published 4 years ago

dyna-gettext v0.2.8

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Dyna-gettext

A tiny npm modules that loads the text from static json files dynamically. Save your text in a json file. They key will be used as id of that text. Below is a text file. Save it as mytext.json.

{
    "hello" : {
        "en" : "Hello [name]",
        "fr" : "Bonjour [name]"
    },
}

You can can load this file in your app in following way

const dynatext = require('dyna-gettext');
dynatext.load(__dirname + '/mytext.json', 'mytext');

(async () => {
    let d = await dynatext.getText("hello", {id: 'mytext', lang: 'fr'}, {name: 'Nauroz'});
    console.log(d);
    //Bonjour Nauroz
})()
0.2.7

4 years ago

0.2.8

4 years ago

0.2.6

4 years ago

0.2.3

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago