Translation and translation management system using json files
npm install --save translatejson
Create a local folder at the root of your project (or at another location but don't forget to configure it) Then create a en.json, fr.json and other xx.json file
Initialize the class
Parameters
Examples
const translatejson = require("../index")
let Translate = new translatejson("fr", "./resources/locales/");
Select the line defined by the key
Parameters
Examples
Translate.GetLine("hello");
Translate.GetLine("hello users", "deathart");
Returns string
Select block defined by the key
Parameters
Examples
Translate.GetBlock("block.first_block");
Translate.GetBlock("block.sec_block", "deathart");
Returns string
Add a key to the json file
Parameters
Examples
Translate.SetLine("good bye", "Good Bye");
Returns boolean
Update a key in the json file
Parameters
Examples
Translate.Update("hello", "Bonjour");
Returns boolean
Deletes a key in the json file
Parameters
key
string Key name
Examples
Translate.Del("hello");
Returns boolean
finds a key in the json file
Parameters
key
string Key name
Examples
Translate.resolve("hello");
Translate.resolve("block.first_bloc");
npm test
Don't hesitate to help this project, to improve it to make it grow, even constructive criticism helps.