20d3a29887
* upgraded ember-moment and use it application-wide service to set locale * label on poll/participation now observes locale changes, but it's still hacky * replace computed property on views poll by moment-format helper of ember-moment
21 lines
560 B
JavaScript
21 lines
560 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: 'select',
|
|
classNames: [ 'language-select' ],
|
|
i18n: Ember.inject.service(),
|
|
moment: Ember.inject.service(),
|
|
current: Ember.computed.readOnly('i18n.locale'),
|
|
|
|
locales: Ember.computed('i18n.locales', function() {
|
|
return this.get('i18n.locales').map(function (locale) {
|
|
return { id: locale, text: locale };
|
|
});
|
|
}),
|
|
|
|
change() {
|
|
var locale = this.$().val();
|
|
this.get('i18n').set('locale', locale);
|
|
this.get('moment').changeLocale(locale);
|
|
}
|
|
});
|