STB SDK localization.
npm install stb-gettextSTB SDK localization
====================



STB SDK localization module. It's an instance of Model component.
Contains localization messages data used by other modules and provides methods to requests these messages.
``bash`
npm install stb-gettext
Add to the scope:
`js`
var gettext = require('stb-gettext');
Load localization messages file (./lang/ru.json):
`js`
gettext.load({name: 'ru'}, function ( error, data ) {
debug.log(error);
debug.inspect(data);
});
Then it's possible to make direct calls to make simple replacement:
`js`
console.log(gettext('some line to be localized'));
Fetch a particular translation of the textual message:
`js`
console.log(pgettext('some context', 'some text'));
Native language translation of a textual message whose grammatical form depends on a number:
`js`
console.log(ngettext('{0} cat', '{0} cats', 1));
It's also possible to listen to instance events (load and error):
`js`
// subscribe to events
gettext.addListener('load', function () {
...
});
> There is a global var DEBUG which activates additional consistency checks and protection logic not available in release mode.
If you have any problem or suggestion please open an issue here.
Pull requests are welcomed with respect to the JavaScript Code Style.
stb-gettext` is released under the GPL-3.0 License.