translatejson v1.3.19
Translation and translation management system using json files
Table of Contents
Install
npm install --save translatejsonCreate 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
API
Constructor
Initialize the class
Parameters
Examples
const translatejson = require("../index")
let Translate = new translatejson("fr", "./resources/locales/");GetLine
Select the line defined by the key
Parameters
Examples
Translate.GetLine("hello");
Translate.GetLine("hello users", "deathart");Returns string
GetBlock
Select block defined by the key
Parameters
Examples
Translate.GetBlock("block.first_block");
Translate.GetBlock("block.sec_block", "deathart");Returns string
SetLine
Add a key to the json file
Parameters
Examples
Translate.SetLine("good bye", "Good Bye");Returns boolean
Update
Update a key in the json file
Parameters
Examples
Translate.Update("hello", "Bonjour");Returns boolean
Del
Deletes a key in the json file
Parameters
keystring Key name
Examples
Translate.Del("hello");Returns boolean
Resolve
finds a key in the json file
Parameters
keystring Key name
Examples
Translate.resolve("hello");
Translate.resolve("block.first_bloc");Tests
npm testHelps
Don't hesitate to help this project, to improve it to make it grow, even constructive criticism helps.
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago