Last active
June 5, 2018 10:37
-
-
Save cbou/910eefc652a09838b15674ffe8e39cd3 to your computer and use it in GitHub Desktop.
i18n
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import { translationMacro as t } from "ember-i18n"; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
i18n: Ember.inject.service(), | |
init: function() { | |
console.log(this.get('i18n').t('plural', {count: 1}).toString()); | |
console.log(this.get('i18n').t('plural', {count: 0}).toString()); | |
console.log(this.get('i18n').t('plural', {count: 1}).toString()); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ember-I18n includes configuration for common locales. Most users | |
// can safely delete this file. Use it if you need to override behavior | |
// for a locale or define behavior for a locale that Ember-I18n | |
// doesn't know about. | |
export default { | |
// rtl: [true|FALSE], | |
// | |
pluralForm: function(count) { | |
if (count === 0) { return 'zero'; } | |
if (count === 1) { return 'one'; } | |
if (count === 2) { return 'two'; } | |
if (count < 5) { return 'few'; } | |
if (count >= 5) { return 'many'; } | |
return 'other'; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
"plural": { | |
"zero": "Zero plural", | |
"other": "Other plural" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.13.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"i18n": { | |
"defaultLocale": "en" | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3", | |
"ember-i18n": "5.2.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment