JS-TRANSLATE
Very easy i18n library. Just load your data, and then start to translate.
- supports wildcards
- supports regional dialects with residing to global
- several levels of warning
Usage
import { i18n } from 'js-translate';
const translator = i18n({ language: 'en', defaultLanguage: 'en' });
translator.add([{
language: 'en',
data: {
'my string': 'Some translated stuff!',
'string with {params}': '{params} is here!'
}
}]);
translator.translate('string with {params}', 'Date');
-> Date is here!
translator.useLanguage('ta');
You could specify several translators, with different parameters. If default wildcards isn't appropriate to you, then you could change it:
const translator = i18n({ language: 'en', startSeparator: '{{', endSeparator: '}}' });
And again, all instansiated translators don't share these settings.
© 2015 MIT