I am trying to understand how to internationalize a web-app developed with emberjs.
I found the ember-i18n package that I think is a good solution, but I can't understand how to use it.
The first thing you'll need to do is to create hash with all your localizations, you always pair up a identifier with the localized string.
The best practice here is to create a put all locales you have into a seperate file. (like loc-english.js)
Em.I18n.translations = {
'login.loginbutton': 'Login',
};
When your webapp is getting loaded, make sure you load your strings file. All string must be loaded before you render the first view with ember.
The actual use is quite simple you just use the 't' helper in your template
<button class="login">{{t login.loginbutton}}</button>
Which will result in Login
You can find more information at: https://github.com/zendesk/ember-i18n/blob/master/README.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With