Currently this is the complete list of issue related to i18n and they fairly much hit all sections of the module in some way. As attisan puts it:

this module IS very useful - as long as one isn't using a multilingual webpage

Field display / Core list translation / Core properties
#1415284: Countries in profile select-list not translated

Attached Fields
#1660370: Countries is not integrating properly with Entity Translation

Importing
#1812384: load translated country names into i18n
#1830198: Better support for various providers of Country data.

Views
#1803548: Countries views field "name" does not work with countries_i18n

Misc
#1891106: country field: content language VS interface language

So an i18n newbie's take...

Initiation and updates

Most country names will default to the current language that the module was enabled on as the module uses Drupal's internal list to specify the names. The official name will most likely be in English.

Support for t() during the import was added with #1490864: Multilingual Support in field_formatter, April 6, 2013, so all names will potentially be imported in the correct language. That is if "correct" is read as the language that the site was in when the module was installed.

Task One
Update names on install from the csv file. Done as per some per comms suggested that this was best and to make task 2 possible.

The core function, _country_get_predefined_list(), uses a static cache for the translated strings making a language change impossible. :/

Task Two (storage)
Translate all country entities in the default site language in the db and record what that language was.

Task Three (updates)
Going with the KISS, db is updated to the sites default language.

Task Four (imports)
Translated to the default language during updates.

Translatable properties

The name property should be translated if countries_i18n is enabled as of #1609150: Support entity label (and callback) (June 30, 2012) and #1889998: Use label callback instead of name property (April 6, 2013). This has been refactored to provide contextual i18n translations.

Task Five
Use a single point of handling properties. Without defining a custom entity per say, this has been assigned to the function country_property() function.

API Change

- function country_property($country, $property, $default = NULL, $sanitize = TRUE)
+ function country_property($country, $property = 'name', $options = array())

There is a wrapper to parse parameters that use the 7.x-1.1 format.

Direct use of countries_t() and $country->label() is depreciated in favor of country_property(). $country->label() was depreciated as there was no apparent entity language context for any specific request.

Lots of changes here to chain the content language down where applicable.

  • $item['safe_value'] is the countries name in the entities language. Only used as a formatter fallback internally.
  • country_property() and entity language is used on all core formatters. If not set, $language_content is used.[Maybe will fallback to $language here?]
  • countries_get_countries() now accepts a langcode parameter and defaults to the global interface language.
  • The country FAPI element now accepts a language parameter albeit not used internally.
  • Diff integration converted this this
  • No widget translations. There is no context given in the options callback, so this is also left out of the country/continent widget. I think that this is the norm anyway ;)
  • countries_t() will only trigger countries_i18n_translate() if the db language does not match the requested language.
  • countries_get_continents() et al all accept language arguments
  • New views field handler
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alan D.’s picture

Issue summary: View changes

Updating the issue summary

Alan D.’s picture

Status: Active » Needs review
FileSize
33.44 KB

Status: Needs review » Needs work

The last submitted patch, countries-2032835-1-i18n-overview.patch, failed testing.

Alan D.’s picture

Status: Needs work » Needs review
FileSize
39.13 KB

Test failures due to the import testing non-modified country names when the installation now does this automatically.

Status: Needs review » Needs work

The last submitted patch, countries-2032835-3-i18n-overview.patch, failed testing.

Alan D.’s picture

Status: Needs work » Needs review
FileSize
44.91 KB

Probably should be testing locally ;)

Status: Needs review » Needs work

The last submitted patch, countries-2032835-5-i18n-overview.patch, failed testing.

Alan D.’s picture

Status: Needs work » Needs review
FileSize
48.12 KB

Hopefully the last fix. countries_country_lookup() was sanitizing the properties during the look up.

Status: Needs review » Needs work

The last submitted patch, countries-2032835-7-i18n-overview.patch, failed testing.

Alan D.’s picture

Minor modifications to the country_property() default fallback and no longer sanitizes the altered country list.

Alan D.’s picture

Alan D.’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, countries-2032835-10-i18n-overview.patch, failed testing.

Alan D.’s picture

Status: Needs work » Needs review
FileSize
52.91 KB
Alan D.’s picture

Some screenshots of the changes in action.

Views

Viewing in Spanish

Viewing in English

Firstly note that the field country relationship does not keep content language scope, so this fall's back to the current site language. These are the two last columns Name & Official name.

Field columns are displayed in the scope of the entity language (cc & country columns) and falls back to the current site language if language neutral.

Filters are in the sites current language.

This also shows on the node view pages

1) Spanish (default site language) content

When viewing the site in Spanish

And in English

2) English content

When viewing the site in Spanish

And in English

3) Language neutral content


When viewing the site in Spanish

And in English

Alan D.’s picture

Minor enhancement to the admin listing page to show both the current language and the default language if i18n enabled.

Alan D.’s picture

Another minor mod. Uses the db value if language matches (saves a i18n string lookup)

Alan D.’s picture

Issue summary: View changes

Full overview

Anybody’s picture

The last comment was two years ago but the module is still missing translation of the field handlers in views (when not using an entity field but a relation). What will happen here?

Alan D.’s picture

...

Was that an offer to re-roll, review and test the patch? To a level that will not negatively affect 17,000 users?

Anybody’s picture

Yes, it was primary a first question to find out what's the state here, especially to find out if there are still people working on this issue or from what point we'll have to rethink this.
Two years are a long time and it might have happened that other issues or improvements influenced this topic. Doesn't it?

My question was not written well, I apologize for that. So to sum up the current issue state is the status-quo and we can proceed from here.

Alan D.’s picture

My question was not written well, I apologize for that

np. Things are very close to head as I simply haven't had the time recently to maintain anything.

Status: Needs review » Needs work

The last submitted patch, 16: countries-2032835-16-i18n-overview.patch, failed testing.