Change Map language dynamically
See original GitHub issueIs it possible to change map language dynamically when language is changed ? Or at least have the language map changed the next time I access it (after language is changed).
I can set default language on map loading using this code (in mymap.module.ts) :
@NgModule({ imports: [ AgmCoreModule.forRoot({ apiKey: 'MY_KEY', language: 'es', }), ], })
And I can get the current language using this.translate.currentLang (in mymap.component.ts).
But I don’t know how I can combine both.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Change angular-google-maps language dynamically
To do this, I've created a class called AppInitService. Here, I'll initialise various properties in my app on the fly, such as translation ......
Read more >Change Map language dynamically · Issue #1358 - GitHub
Is it possible to change map language dynamically when language is changed ? Or at least have the language map changed the next...
Read more >Changing the Map Language | Google Maps plugin for Craft ...
It's easy to change the language of your map by adding a few extra query parameters to the Google Maps API URL.
Read more >Localizing the Map | Maps JavaScript API | Google Developers
You can customize your map for a specific country or region in the following ways: Change the default language settings. Specify a region...
Read more >Change a map's language | Mapbox GL JS
Change a map's language ... Ready to get started? Create a free account to start building with Mapbox. ... Use setLayoutProperty to switch...
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
this was already discussed in another issue. As the google maps api does not support this officially, AGM will not implement this
Obviously, this approach will not work if you run your app with --aot flag. This actually makes sense. I was able to make it work with solution found here and
window.localion.reload()
. Even though the original question and answer are about overriding the API key and loading it separately, one can override any config field, including the language. Here’s the code of theload
method in the custom MapsAPILoader: