doublesecretagency / craft-mapbox

Other
3 stars 1 forks source link

Configurable language for the address field #7

Closed MoritzLost closed 1 year ago

MoritzLost commented 1 year ago

I've noticed that the address field always returns results in English, which is not great for sites in a different language. I haven't found a way to configure the language for the address autofill, or did I miss it?

The API supports a language parameter to control the language for search results.

I think this should be addressed (pun alert) in the following ways:

  1. By default, autofill should use the current user's language.
  2. A plugin configuration option should be added to force a specific language (the Google Maps plugin supports this with the fieldParams config option).
lindseydiloreto commented 1 year ago

Sounds good. I'll take a look into it, and try to have this done within the next few weeks.

lindseydiloreto commented 1 year ago

This is done. It works pretty much how you described...

  1. By default, the map & search results will attempt to use the current user's language (if it's valid for Mapbox).
  2. You can manually override the language in the config/mapbox.php file (using the new fieldParams option).

These changes will go out in the next release (hopefully within the next few weeks). If you want to take it for a spin before then, feel free to pull the latest dev version...

"doublesecretagency/craft-mapbox": "dev-v1-dev"
MoritzLost commented 1 year ago

@lindseydiloreto Thanks! Just gave it a try, both the automatic language detection (tested in de and en) and forcing a specific language via the config work great! 🚀

lindseydiloreto commented 1 year ago

@MoritzLost Awesome, thanks for reporting back! 👍

lindseydiloreto commented 1 year ago

Great news, v1.1 has been officially released with these changes. Thanks for the feature request! 🎉

MoritzLost commented 1 year ago

@lindseydiloreto Awesome, thanks!