decide.nolog.cz/app/components/language-select.js
jelhan 20d3a29887 update dates on locale change
* 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
2015-11-23 13:32:40 +01:00

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);
}
});