How to load locale dynamically
See original GitHub issueI am developing an ionic 2 app. To localize angular2-moment I just included lang module in app.module.ts after including angular2-moment like this and that automatically pulled spanish language:
import { MomentModule} from 'angular2-moment';
import 'moment/locale/es';
My app use cordova-plugin-globalization to dinamically set app language so, how can I load the lang locale dynamically?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How do I dynamically import locales in Angular 9?
The solution is to use Webpack's "magic comments". The following is enough to get everything loading properly: const base = import( /* ...
Read more >Dynamic Import of Locales in Angular | by Michael Karén
The Goal. Remove import statements for locales; Replace switch statement with dynamic import; Lazy loading. We want to remove the imports of locales:...
Read more >Angular Dynamic Locale - StackBlitz
* Open terminal and go to project folder. * Run `npm` or `yarn` in terminal to install.
Read more >Code-splitting react-i18n locales using dynamic imports
Hence, a better solution would be to load only the required locale files or load them on demand. And this can be achieved...
Read more >Lazy Loading Locales with Angular - ANGULARarchitects
However, we can divert it from its intended use to load the meta data dynamically on demand. This article shows how to leverage...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made a pipe and it worked to actualize the date on a language change:
Hi, I managed to do so by ` moment. locale (‘es’); when a language change is detected, however, I haven’t found a way yet to update the currently printed ones.