Skip to content
This repository has been archived by the owner. It is now read-only.
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

TravisCoveralls githubnpmnpm

Translation and translation management system using json files

Table of Contents

Install

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

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

  • Lines string Key name
  • Replace string? Replace string in value (Optional, default null)

Examples

Translate.GetLine("hello");
Translate.GetLine("hello users", "deathart");

Returns string

GetBlock

Select block defined by the key

Parameters

  • Lines string Key name
  • Replace string? Replace string in value (Optional, default null)

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

Examples

Translate.Del("hello");

Returns boolean

Resolve

finds a key in the json file

Parameters

Examples

Translate.resolve("hello");
Translate.resolve("block.first_bloc");

Returns (string | boolean)

Tests

npm test

Helps

Don't hesitate to help this project, to improve it to make it grow, even constructive criticism helps.

About

Translation and translation management system using json files

Topics

Resources

License

Releases

No releases published
You can’t perform that action at this time.