lgalfaso / angular-dynamic-locale

Module to be able to change the locale at an angularjs application
http://lgalfaso.github.io/angular-dynamic-locale/
MIT License
322 stars 75 forks source link

Dynamically loading locales #115

Closed nmani85 closed 6 years ago

nmani85 commented 7 years ago

My locales can change at runtime. Initially the view (currency and date filters) is loaded with the default locale (en-US), but how do I alter the filters after a localeChangeSuccess event without reloading the state? http://jsfiddle.net/xparma/pt6s0ha4/ this shows the default behavior. But my problem occurs in a aprticular scenario:

  1. Load parent controller (Sets locale via a promise)
  2. Child Controller - loads the view and has the currency and date filter.

The child controller has already loaded with the default view while the locale is still being resolved in the parent.

lgalfaso commented 7 years ago

Sorry, but from the description it is not clear what is not working or what are you trying to achieve.

Is the issue how to set the initial locale? Is the issue that on startup things are displayed using the English locale and then, when the new locale is loaded, things are rendered using the new locale? Is the issue that the child does not refresh the value of the currency/date when the locale changes? Something else?

From the example, I do not know what should I be looking at.

nmani85 commented 7 years ago

Sorry for not being clear. On startup it uses en-US locale, but when the new locale is loaded later, things(currency and date format) are not rendered using the new locale.

lgalfaso commented 7 years ago

Here is an updated version of your example with some cleanups http://jsfiddle.net/udaqftpc/1/ It also has a value INITIAL_LOAD that mocks the initialization of the locale value if this is done on the initial load or asynchronously.

With this example, I was not able to make it fail (unless there is something else in the example that I missed.

UPDATE: The link now points to the right updated example.

lgalfaso commented 6 years ago

Without an update in quite some time, I think it is safe to close this issue.