最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use emberjs and internationalization - Stack Overflow

programmeradmin2浏览0评论

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.

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.

Share Improve this question edited Jan 16, 2013 at 6:30 Zak 7,0776 gold badges38 silver badges54 bronze badges asked Mar 24, 2012 at 10:33 RedBassRedBass 3282 silver badges12 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

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./zendesk/ember-i18n/blob/master/README.md

发布评论

评论列表(0)

  1. 暂无评论