Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author CodeFish

    (@codewahoo)

    The easiest solution is adding an extra ACF field with a list of languages. This should cope with your needs. Could you provide a real world example of the use case and I might consider adding the language then?

    P.S.: Thanks for the compliment!

    Thread Starter phloo

    (@phloo)

    Hi, thanks for the reply.

    The problem is in the backend when Google maps load it automatically sets the language interface to the browser accept-language and so, the search results in the address field is in that language. ACF saves this and its not possible to change it.

    My idea was to include the map with a javascript url parameter (country code). If I add an extra field (like a select list), I would need to refresh the load after selecting the desired language.

    Maybe this is possible, since ACF Pro has js hook support.

    Plugin Author CodeFish

    (@codewahoo)

    I see what you mean now.
    This feature was considered initially, but didn’t get implemented as its added value didn’t match the efforts it required. The reason behind this is that it requires Google maps library reloading. As you probably understand, this plugin is not the one using it in many use cases. Thus, it would influence other dependencies.
    While loading the plugin checks if Google maps library was already initialized and skips that step preventing any ways to add the country code you want.

    Thread Starter phloo

    (@phloo)

    yeah, I understand. Well, maybe ACF itself will implement this.
    Otherwise we will use an extra field.

    Thanks for the feedback.

    Plugin Author CodeFish

    (@codewahoo)

    I hardly doubt, but who knows.
    I will consider adding this feature in the next release. The disadvantage is that there will have to be a hard-coded list of all country codes supported by Google Maps.

    Thread Starter phloo

    (@phloo)

    Hehe. Yeah.

    You can grab it here:
    https://googlemaps.github.io/js-samples/map_language/map_lang.html

    Its officially from the google maps resources

    Plugin Author CodeFish

    (@codewahoo)

    Hi.
    I gave the problem you raised another round of thinking and came up with the following solution.
    Address bar above the map is bound to the Geocoder’s results. And, indeed, those results are influenced by the browser’s accept-language, if you don’t provide the language code, while referencing the Google Maps API. However, adding the language code doesn’t absolutely guarantee that you will be satisfied with the results of the Google’s Geocoder, as it can still set the marker in the wrong place (results are not 100% accurate). On the other hand, if you adjust the marker’s location in such a situation, then the address is also updated by using the reverse geocoding. And this is all an expected behavior for this plugin’s map component.
    If you want to have the address to be different from what Google’s Geocoder provides, you need to go a bit beyond the plugin’s map component by adding an extra ACF field to your post. That should be a text field, which will store any address you want to associate with the map’s marker. You can also do it in any language you want and won’t feel yourself limited in a way. And this plugin will perform its function – providing a visual interface for setting a marker on the map along with zooming level.

    Thread Starter phloo

    (@phloo)

    Thanks for getting back on this. And yeah we agree on most of the points.

    But in detail it’s not the problem to add another field to insert the desired address name. I was talking about the actual language and how it’s spelled

    Here is an example. Choose Cairo in Egypt.

    German as accept-language brings up: “Kairo, ?gypten”.
    English as above. So if the user doesn’t now the correct spelling, it’s a pain in the ass to add it manually to the other text field.

    My problem is not the marker but the result in the address bar. Depending on the language. So that’s why I am looking for a solution to add the language of (my) choice to the map function.

    Plugin Author CodeFish

    (@codewahoo)

    Thanks for the clarification. I clearly understand your use case now.

    However, if a user gets results in German, because of their browser’s accept-language, it means at least that their system (OS) should have German as the default language and so they should know the language as well. Thus, what happens in the map component is an expected behavior. They type and get results in their OS’s/browser’s language.

    Now, what you outline is that a German speaking user might want the address in English for the front-end purpose, but he/she might not necessarily know English and you want the map field to translate the address for them. I must admit here that this is a completely another domain – translation. We are not building or even trying to build an automated address translation component. Instead, it is a component with visual interface for adding locations.

    I’m still convinced that extra ACF text field accompanying the map field will do the job for you. Only users creating locations know (or at least should know) the accurate addresses of the locations they add and they should care about the correct translation as well.

    I was thinking to add country codes to limit Geocoder’s result output, but it doesn’t seem relevant for most of the people, as they are quite ok, if there is a country stated next to the address in the results so they can select the right one.

    I would also discourage from trying to add language code to the Google map’s API reference URL. This matter can cause further issues, as Google maps stop working, if you reference the API more than once at one page.

    Thread Starter phloo

    (@phloo)

    It is a special use case indeed. And in most of the times the browser accept-language will do it. Sometimes it’s just the other way, hehe.

    Well, I had a location field before so we won’t use the address bar. It would help but the effort to add this function might not be in a good relation to the output.

    But I dont understand why you mention it multiple times that the users know the exact address? Of course they do but they dont know all the correct translations for city and country. Thats why I was talking about translation.

    If you enter the desired address in the google address bar, at least you get the right names. It’s not about the marker in this case.

    Thanks and good to know that there could be problems if there is more than one reference on the same page using the API.

    Plugin Author CodeFish

    (@codewahoo)

    You are always welcome!

    Probably, you are right saying that users don’t know the correct translations for addresses. However, it is once again another domain and should be up to them to check for the right translations. Post content is not translated by its own as well. Someone should do the job. That’s my point. Also, imagine a situation that Google gives you not accurate or too long address and you simply want it to be different. Custom field is the simplest way around here. More flexibility and more chances for the users to know their content better resulting in a more accurate content. Hehe.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[feature request] add language support’ is closed to new replies.