वहाँ एंबर के लिए एक I18n पुस्तकालय है: zendesk/ember-i18n।
एक हैंडल सहायक t
जो Em.I18n.translations
से स्ट्रिंग ऊपर देखकर भी अंतर्राष्ट्रीयकरण संभालती है:
Em.I18n.translations = {
'dog.walk.one': '1 dog has gone for a walk.',
'dog.walk.other': '{{count}} dogs have gone for a walk.'
};
और तुम तो के माध्यम से अपने Handlebars टेम्पलेट में स्ट्रिंग का उपयोग कर सकते हैं:
{{t dog.walk countBinding="dogCount"}}
कोड उपरोक्त अनचाहे है और सिर्फ README में प्रलेखन से लिया गया है।
एक और जे एस I18n पुस्तकालय मैंने पाया एलेक्स सेक्सटन के messageformat.js है।
यह एप्लिकेशन को आप की जटिलता पर निर्भर करता है, लेकिन आप यह भी है कि के लिए एक गणना संपत्ति का उपयोग कर सकते, http://jsfiddle.net/pangratz666/pzg4c/ देखें:
Handlebars:
<script type="text/x-handlebars" data-template-name="dog" >
{{dogCountString}}
</script>
जावास्क्रिप्ट:
Ember.View.create({
templateName: 'dog',
dogCountString: function() {
var dogCount = this.get('dogCount');
var dogCountStr = (dogCount === 1) ? 'dog has' : 'dogs have';
return '%@ %@ gone for a walk.'.fmt(dogCount, dogCountStr);
}.property('dogCount')
}).append();
पर
अधिक जानकारी http://stackoverflow.com/questions/48726/best-javascript-i18n पर एक नजर डालें -टेक्निक-एजेक्स-तिथियां-समय-संख्या-मुद्रा – Reactormonk