3.0.6 • Published 4 years ago

itranslator v3.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

npm version npm.io

translator

node module to deal with translation in your app

Install

Using yarn :

yarn add itranslator

Using npm :

npm install itranslator

Usage

const {
  trans,
  setConfig
} = require('itranslator');

//Returns the same string if no configuration provided
trans('en.hello'); // "en.hello" 

//You can put a global configuration at the entry point of your app
setConfig({
  source : {
    en : {
      hello : "hello"
    },
    it : { 
      hello : "bonjourno"
    }
  }
});

trans('en.hello'); // "hello" 
trans('it.hello'); // "bonjourno" 

//It's also possible to override the global configuration if needed
trans('it.hello',{
  vars : new Map().set('name', 'imam'),
  source : {
    it : {
      hello : 'bonjourno %name%'
    }
  }
}); // "bonjourno imam" 

trans('it.hello'); // "bonjourno imam" 
3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.3

4 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago