js-api-loader
js-api-loader copied to clipboard
Dynamically change the language of Loader
Environment details
- google.maps.places.AutocompleteService
- "@googlemaps/js-api-loader": "^1.11.2",
Steps to reproduce
I load the library as follows
new Loader({
apiKey: process.env.REACT_APP_GOOGLE_PLACES_API_KEY,
libraries: ['places'],
language: selectedLanguage,
});
I can dynamically change the language through a dropdown. If i try to reload the library i get an error that says i cannot use the same api key with different params
How can i dynamically change the results of the autocomplete to the desired language?
Similar to #5, it is not possible to currently change the language after the script has been loaded. There is a very old request for if you want to add your particular use case at https://issuetracker.google.com/35819089. I am hoping to address #5 this year. Language would be a potential followup to that.
In the meantime, I might investigate #100 to allow reloading the entire API, but that might have billing consequences...
Sorry I don't have better news!