matanshukry / flutter_google_places_sdk

Flutter plugin for google places native sdk
32 stars 68 forks source link

[Web] Changing the locale of FlutterGooglePlacesSdk doesn't work #23

Closed jcblancomartinez closed 1 year ago

jcblancomartinez commented 1 year ago

Hi,

Users can change the locale of our app. When that happens, we make a new call to: FlutterGooglePlacesSdk('keyXXX', locale: Get.locale)

The problem with flutter_google_places_sdk_web is that FlutterGooglePlacesSdkWebPlugin is a singleton and locale is only considered the first time locale is passed.

For subsequent instantiations of FlutterGooglePlacesSdk with different locales to the original one, those locales get ignored.

Thanks.

jcblancomartinez commented 1 year ago

Hi @matanshukry ,

Could you please take a look at this?

In my opinion, locale should be passed in each of the methods exposed by FlutterGooglePlacesSdkWebPlugin instead of passing it to initialize.

Thanks.

matanshukry commented 1 year ago

@jcblancomartinez what is your use case? you shouldn't need to create multiple instances of FlutterGooglePlacesSdk

jcblancomartinez commented 1 year ago

As mentioned above, when users change the locale of our app, we want the results from Google Maps API to consider the current language. i.e. for English, it should show Spain, for Spanish, it should show España...

matanshukry commented 1 year ago

@jcblancomartinez implemented and released new versions. You now have an updateSettings method you can use to update the locale after the initial initialization. See https://pub.dev/packages/flutter_google_places_sdk/versions/0.3.2+5

Note:

jcblancomartinez commented 1 year ago

How come are you resolving it if it is not implemented for iOS?

matanshukry commented 1 year ago

@jcblancomartinez your issue was for web - that is resolved. I also created a different issue specifically for iOS: https://github.com/matanshukry/flutter_google_places_sdk/issues/27