![](http://i.imgur.com/hjd3i9m.png)
Translate for Sailor
Translations, translations everywhere
Install
npm install sailor-translate
Usage
translate = require 'sailor-translate'
or using sailor
dependency
sailor = require 'sailorjs'translate = sailortranslate
API
.default()
Get the default language for the Translator
translate = translatedefault# => ''en'
.lang([language])
With argument: Set up the default language to resolve a key.
translate = translatelang'es'translatelang# => 'es'
Without argument: Get the actual language for the Translator.
translate = 'es'translatelang# => 'es'
.add([Objects..])
Add new object to the Translator. Object structure are based in angular-translate objects.
translate = translateadd require './User'translateadd require './Message'
.get([key])
Without argument: Get a list of object added.
With argument: Get a determinate key of the translator.
translate = translateadd require './User'translateget'User.Username.NotFound'# => 'Username not found.'
First try with the language that the user can be set, later with the default language (en) and finally throw a error is don't found the key.
Additional
Is possible concatenate actions in the same object. For example.
Message = require './Message'User = require './User'result = translateaddUserlang"en"get"User.Username.Already"# => "Username already exist."
License
MIT © Kiko Beats