I found a quite confusing configuration issue.

As long the drupal default issue is english, country names get translated right. On the country translation page, the source and translations are correct. E.g. admin/config/regional/countries/AL/translate show "Albania" (english, original) and "Albanien" (deutsch, translation)

After drupal's default language has been switched to german, the german row is marked as source, and the english is marked as translated, where booth are printed as "Albania". The country names get not translated on the website anymore.

Comments

e5sego created an issue.

robin.ingelbrecht’s picture

I can confirm this issue.

My default language is "Dutch" and I can translate to English and French. The Dutch string contains "Spain", which is the English translation.

Anyone has a solution/patch?

matysek145’s picture

Didn't dive into code, but the countries are imported from the countries.csv file, where all the names are in English.
Once you update/(probably while enabling the module too) countries list at /admin/config/regional/countries, before names are inserted into db, they're translated to your current language. So, basically, if my default language is set to english, but i update the list while language is set to polish, the countries names will be translated to polish, but inserted as if they were in english as the source.

Not sure if this is exactly the same issue, but simple workaround is go to /admin/config/regional/countries with your user language set to your default site language, and do the update.

Alan D.’s picture

Does your countries.install file use $t()?

  while (($row = fgetcsv($handle, 1024, ",")) !== FALSE) {
    // The iso2 data.
    $row[0] = trim($row[0]);
    // The iso3 data.
    $row[1] = empty($row[1]) || $row[1] == 'NULL' ? '' : trim($row[1]);
    // The name data.
    $row[2] = empty($row[2]) || $row[2] == 'NULL' ? '' : $t(trim($row[2]));
    // The official name data.
    $row[3] = empty($row[3]) || $row[3] == 'NULL' ? '' : $t(trim($row[3]));

This does assume that the module is enabled in the sites default language.

4kant’s picture

For me the only solution was
under admin/config/regional/i18n/strings
to switch the source language for string translations back to "English".

Not sure if that creates another issue...