An i18n utility belt specifically designed for meteor to seperate your app from the language.
read the full documentation in the wiki or see the quickstart!
- readable yaml files or normal json files to store the language ~docs
- namespacing though multiple files ~docs (this will me be removed in future version to enable other features (like overwriting) and make the package easier to use)
- variables in the translations
hello {username}
~docs - icu messageformat using Unicode cldr ~docs
- date formating using moment and cldr
released on {var, date}
~docs - localized number formating again using cldr
{var, number}
~docs - language fallbacks
["en_GB","en_US"]
- lazy loading of languages as soon as they are needed
- automatic language detection using the
accept-language
header (experimental) - reactive changing of the translations
- a small footprint of 10 kb uglified and even less with gzip
#languages/user.en_US.lang.yml
user_area:
header: "user area"
message:
greeting: "Hello {name}!"
Translator.setDefaultLanguage(['en_US']); // autodetect fallback
FrontLang = new Translator(); // translator for frontend
FrontLang.use('languages/user'); // without the "en_US.lang.yml"
FrontLang.get('user_area.header'); // => user area
FrontLang.get('user_area.message.greeting', { name: "world" }); // => Hello world!
// this JavaScript is required to ensure capsulation
Template.template_name.trans = FrontLang.createHelper();
<template name="template_name">
<h1>{{trans "user_area"}}</h1>
<p>{{trans "user_area.message.greeting" name="world"}}</p>
</template>
- Territory fallback like "i want British English but there is only American English"! This is useful for the auto detection of languages! I need help with this because I don't know if that'll work with most languages!
- Providing more features from CLDR