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
Comment | File | Size | Author |
---|---|---|---|
#16 | countries-2032835-16-i18n-overview.patch | 57.06 KB | Alan D. |
#15 | countries-2032835-15-i18n-overview.patch | 55.64 KB | Alan D. |
#14 | countries-es-view.png | 28.55 KB | Alan D. |
#14 | countries-en-view.png | 11.19 KB | Alan D. |
#14 | countries-node-1-spanish-es-view.png | 6.54 KB | Alan D. |
Comments
Comment #0.0
Alan D. CreditAttribution: Alan D. commentedUpdating the issue summary
Comment #1
Alan D. CreditAttribution: Alan D. commentedComment #3
Alan D. CreditAttribution: Alan D. commentedTest failures due to the import testing non-modified country names when the installation now does this automatically.
Comment #5
Alan D. CreditAttribution: Alan D. commentedProbably should be testing locally ;)
Comment #7
Alan D. CreditAttribution: Alan D. commentedHopefully the last fix. countries_country_lookup() was sanitizing the properties during the look up.
Comment #9
Alan D. CreditAttribution: Alan D. commentedMinor modifications to the country_property() default fallback and no longer sanitizes the altered country list.
Comment #10
Alan D. CreditAttribution: Alan D. commentedComment #11
Alan D. CreditAttribution: Alan D. commentedComment #13
Alan D. CreditAttribution: Alan D. commentedComment #14
Alan D. CreditAttribution: Alan D. commentedSome 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
Comment #15
Alan D. CreditAttribution: Alan D. commentedMinor enhancement to the admin listing page to show both the current language and the default language if i18n enabled.
Comment #16
Alan D. CreditAttribution: Alan D. commentedAnother minor mod. Uses the db value if language matches (saves a i18n string lookup)
Comment #16.0
Alan D. CreditAttribution: Alan D. commentedFull overview
Comment #17
AnybodyThe 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?
Comment #18
Alan D. CreditAttribution: Alan D. commented...
Was that an offer to re-roll, review and test the patch? To a level that will not negatively affect 17,000 users?
Comment #19
AnybodyYes, 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.
Comment #20
Alan D. CreditAttribution: Alan D. commentednp. Things are very close to head as I simply haven't had the time recently to maintain anything.