Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Changing locale but for a specific configuration #259

Open
mesosteros opened this issue Jul 19, 2016 · 2 comments
Open

Changing locale but for a specific configuration #259

mesosteros opened this issue Jul 19, 2016 · 2 comments

Comments

@mesosteros
Copy link

mesosteros commented Jul 19, 2016

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?

@mesosteros
Copy link
Author

mesosteros commented Jul 19, 2016

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

@operfildoluiz
Copy link

Same question here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants