angular-moment
angular-moment copied to clipboard
Changing locale but for a specific configuration
I'm having issues configuring a locale change.
First, I'm setting the locale to english in my angular.module.config and immediately setting the relative time object as I need:
moment.locale('en', {
relativeTime: {
future: "In %s",
past: "%s ago",
s: "<1 minute",
m: "1 minute",
mm: "%d minutes",
h: "1 hour",
hh: "%d hours",
d: "24 hours",
dd: "%d days",
M: "1 month",
MM: "%d months",
y: "1 year",
yy: "%d years"
}
});
This works as intended,
Now I also have an equal object but for german. I don't know where to drop it because if I drop it in the config it overrides the english config.
Then I have a select dropdown in a header menu view with EN and DE (I'm already getting it to lower case for translations) in my controller and I can't seem to associate the amMoment.changeLocale('de');
to change the moment part, and I can't seem to update it with moment directly as well.
How can I achieve this?
A little more information: changed it from config to run. Still the same behaviour. Noticed a strange behaviour on my select: when I change language it catches the language code and moment does apply it, but it does not apply the specific configurations I set in run (wether they are updateLocale, defineLocale or just locale).
Forgot to mention I'm using moment-with-locales.min.js
Same question here