js-api-loader icon indicating copy to clipboard operation
js-api-loader copied to clipboard

Dynamically change the language of Loader

Open mcAnastasiou opened this issue 4 years ago • 1 comments

Environment details

  1. google.maps.places.AutocompleteService
  2. "@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?

mcAnastasiou avatar Mar 18 '21 23:03 mcAnastasiou

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!

jpoehnelt avatar Mar 19 '21 00:03 jpoehnelt