Hello,

Is there a suggested approach to contribute a translation (po) file with translated country names?

We have come up with a french po file with correct msgctxt containing both "name" and "official name" and would love to contribute.

We had to "patch" a few names with information we found on (for example) wikipedia. How official or standards compliant does this have to be?

Best regards

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alan D.’s picture

Not big on i18n things, but a lot of this data could be parsed from the unicode cdlr fairly easily, and extended out.

i.e. from the xml files there is a list of country names.

For example, a sample from common/main/am.xml

			<territory type="AC">አሴንሽን ደሴት</territory>
			<territory type="AD">አንዶራ</territory>
			<territory type="AE">የተባበሩት አረብ ኤምሬትስ</territory>
			<territory type="AF">አፍጋኒስታን</territory>
			<territory type="AG">አንቲጓ እና ባሩዳ</territory>
			<territory type="AI">አንጉኢላ</territory>
drzraf’s picture

drzraf’s picture

drzraf’s picture

I tried the ~/.gem/ruby/1.8/bin/i18n-translate from the above i18n-translators-tools but it fails to handle the format of the YAML files of i18n-country-translations.
So I came with the following:
download en.yml (our reference), then:
sed -re 1,2d -e "s/^ *([^:]+): (.*)\$/s;\1:;\2:;/" en.yml > countries.filter.sed
will replace the iso2 keys by the english string (expected default msgid for Drupal).
Then:
sed -r -e 1,2d -e '/: /s/^[[:blank:]]+("[^"]+"): (".+")$/msgid \1\nmsgstr \2/' countries-i18n/ja.yml > ja.po
will build an (invalid) po file from the yaml which misses the header. Drupal complains about that but import successfully the string.

I specified the japanase language and the countries text group.
Now comes the issue on the countries_i18n side: the string was imported in no group while the group expected was countries:country:XX:name.

Is the countries_i18n textgroup i18n API correctly implemented ?

[edit] got it: I missed the msgctxt[/edit]

drzraf’s picture

Ending up with:
# only once
sed -re 1,2d -e "s/^ *('?([^:']+)'?): (.*)\$/s;\1:;\2!\3:;/" en.yml >| countries.filter.sed
# then, for each language you want

sed -f countries.filter.sed countries-i18n/ja.yml | \
  sed -r -e 1,2d -e '/: /s/^[[:blank:]]+(..)!("[^"]+"): (".+")$/msgctxt "country:\1:name"\nmsgid  \2\nmsgstr \3/'

(and import that file)

Now I need to understand why my country field isn't translated but that's probably another story.
[edit] switching the display format to Default translated helped a lot [/edit]

Note: I've an irresistible desire to mark this bug depending of drush ability to load po files...

drzraf’s picture

I was wrong: po import seems possible using https://drupal.org/project/drush_language
I asked about the textgroup option specification there (#1856646: plan to add a --textgroup option for language-import ?)

Alan D.’s picture

Title: Country name translation files » Better support for various providers of Country data.
FileSize
43.06 KB
10.53 KB
29.16 KB
21.21 KB
8.96 KB

Taking this one step further, and planning to provide a new sub-module to integrate imports / updates.

No patch as of yet as this is a work in progress.

Providing two core services, the ISO list as things currently stand and a HTTP request to the cdlr repo trunk.

Some screenshots, noting that the property update bit will need some tidying up.

So to start off, you get to choice what one you want. And if i18n, the language to import to.

Core can provide all values and is read from the internal CSV file. This will take the place of the import functionality that currently resides in the base countries module.

The CLDR only provides the ISO and Name, so the properties list is adjusted.

CLDR has a massive multi-locale data source, broken into base languages here.

And step two. This is not a bulk editing form, so any values that are not new with the import are disabled out. Imho, it makes it a very slick interactive selection process.

Hopefully get a patch in play by next weekend, although this one is postponed until #2032835: [META] Finialise i18n issues gets in.

Alan D.’s picture

Component: Countries I18n » Code
Status: Active » Needs review
FileSize
42.83 KB
14.42 KB

First patch simply removes the import, the second also adds the new sub-module.

Status: Needs review » Needs work

The last submitted patch, countries-1830198-8-with-country_import-sub-module.patch, failed testing.

dafeder’s picture

I'm trying to get this working - what version was this patch made against? Fails for me as well. Any chance of an update?

bohemier’s picture

I'm also trying to do the same... thanks

czigor’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
43.38 KB

Tried the CLDR import and it works like a charm on our site with 4 languages.

The patch needed a reroll which I attach here.

Status: Needs review » Needs work

The last submitted patch, 12: countries-1830198-12-translation-import.patch, failed testing.

czigor’s picture

czigor’s picture

Status: Needs work » Needs review
4kant’s picture

The patch from #14 worked for me with core ISO list.

From CLDR repository I got no data imported after having selected this address:

4kant’s picture

johnv’s picture

Component: Code » Countries configuration