New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

translatejson

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

translatejson

Translate node APP JSON

latest
Source
npmnpm
Version
1.3.19
Version published
Maintainers
1
Created
Source

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.

Keywords

translate

FAQs

Package last updated on 08 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts