Closed belgoros closed 5 years ago
It works if I put the initializer in instance-initializers
directory and NOT in initializer
as explained in Localization section of README.
Hi @belgoros , I have the same issue. Which initializer did you move to instance initializers ?
Note: noob with emberjs.
@afriqs I moved setup-pikaday-i18n.js
defined as follows:
import Ember from 'ember';
import moment from 'moment';
export default {
name: 'setup-pikaday-i18n',
initialize: function(application) {
var i18n = Ember.Object.extend({
months: moment.localeData()._months,
weekdays: moment.localeData()._weekdays,
weekdaysShort: moment.localeData()._weekdaysShort
});
application.register('pikaday-i18n:main', i18n, { singleton: true });
application.inject('component:pikaday-input', 'i18n', 'pikaday-i18n:main');
}
};
to app/instance-initializers/setup-pikaday-i18n.js
. Hope this helps.
@belgoros Thanks for your feedback but unfortunately I did not manage to localize the datepicker :disappointed: : will have to dig deeper...
@afriqs If you're using inputless component, add this line in the bottom of initialize method: application.inject('component:pikaday-inputless', 'i18n', 'pikaday-i18n:main');
I think the issue here could be the timing between your initializers.
i18n
and moment
servicesmoment
object and uses that information to configure PikadayAre you sure that 1
happens before 2
?
I would suggest specifying the order of the initializers and making sure that 1
happens before 2
.
I'm going to close this issue for now -- please let me know if that doesn't solve the issue and I'm happy to re-open this.
If that doesn't solve the problem and you can produce a simple reproduction application, I'm also happy to dig into that and see if there is a bug here.
I followed the ember-i18n steps to set up a locale globally as well for
moment
service:When I created an initializer as suggested in your README#Localization section, it still has no effect:
Months are still displayed in English. I also inclide all locales in
environment.js
as follows:I also defined
i18.js
initializer:What am I doing wrong ?