Neither with i18n nor with entity translation switcher the country names are correct.

E.g. in a German/English site the country names should be Deutschland and Germany when the language is switched. But either the name is shown as Germany/Germany or as Deutschland/Deutschland. The modules addressfield and the ubercart-location module do it correctly.

I saw that when I cleared the cache of Drupal the country name was shown in the appropriate language. For instance I switched from English to German, it was shown as Germany, then cleared the cache, Deutschland was shown, then switched to the English version, again Deutschland, cleared the cache ....

Debugging of the location module shows the following:

In line 1165 the function location_load_location gives the country_name in line 1201 by calling the function location_country_name (line 610 from location.inc). This function calls "location_get_iso3166_list" in which the function country_get_list is called and the result is cached as $countries.

Which means that after the string is cached in the active language of the moment, the country name holds up until the cache expires. So the actual country name is randomized by the time the cache expires and the user language the site is called next.

But I can't find a hook to change this.

So does anyone has an idea to solve this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.