In order for Drupal translation to work on country names / zones, these must all be stored in the database in English with a Latin character set. While the country names have been changed to English for Drupal 7 / Ubercart 3, some zone name are still entered in other character sets. Here is a list of the CIFs which need to have their zone names Romanized:

china_156_1.cif
egypt_818_1.cif
greece_300_1.cif
japan_392_1.cif
kazakhstan_398_1.cif
taiwan_158_1.cif
thailand_764_2.cif
russia_643_1.cif
ukraine_804_1.cif

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

I am wondering if this is actually required. We don't translate other parts of addresses, so why translate zones? Shouldn't they just be stored as their native name?

I can see adding translations could actually cause problems here - if you use this data for address labels, you want the country name in your local language (so your domestic shipper knows to send it overseas), but the zone name in the language of the destination country (so it gets delivered correctly after arriving in the country).

TR’s picture

The reason to Romanize them is if we want to use Drupal translation. If we don't need translation, then I guess it doesn't need to be done. Or it can be done like whoever wrote the Taiwan cif did; enter the zones twice - once in latin characters and once in local script.

I suspect the Universal Postal Union (http://www.upu.int/) has a standard on what should be done with zones, and I suspect that standard says English is the lingua franca for addressing mail. I haven't tried to look this up yet.

Personally, I have shipped thousands of orders internationally, to 67 different countries, including all the above countries except Egypt and Kazakhstan. Never once has a customer typed any part of their name or address in a local script (although I allow it); I have always addressed the packages using the latin character set, and the packages have always arrived. In fact, it's interesting that most customers confine themselves to ASCII and don't even use the extended latin character set.

charlie-s’s picture

it can be done like whoever wrote the Taiwan cif did

TR, where is this .cif located?

I misread, I was looking for the Thailand cif not the Taiwan. See below posts.

charlie-s’s picture

To elaborate, I'm using PayTrace as the payment gateway. Orders to countries (like Thailand) where the zone is non-ASCII are being rejected by PayTrace.

charlie-s’s picture

FileSize
1.74 KB

I translated the Thailand cif, it is attached.

The remaining countries that I see needing translation are:

  • Ukraine
  • Russia
  • Kazakhstan
  • Japan
  • Iran
  • Greece
  • Egypt
  • China
charlie-s’s picture

FileSize
8.06 KB

I'm going to throw these up here now, though they are to be considered a work in progress. As TR pointed out in IRC they will need _update() functions to translate sites' databases that are using the existing names into the new English names. That will be a fun job. For now, here they are with the correct zone names, but only Ukraine, Russia, and Japan have the correct codes - others are using the alpha codes that are apparently very old and do not coincide with the ISO codes.

For documentation's sake, here's where I've been getting data from: http://en.wikipedia.org/wiki/ISO_3166-2:GR

The abbreviation can be changed to get the appropriate country quickly, i.e. Japan = JP = http://en.wikipedia.org/wiki/ISO_3166-2:JP

Edit: let me add that these are for D6 and will need to be updated for D7 as well.

kriskhaira’s picture

FileSize
34.2 KB

Those CIF files didn't work for me on Drupal 7.14 and Ubercart 7.x-3.1 so I've made this patch.

longwave’s picture

Status: Active » Needs work

Thanks for the patch. This looks good, but needs work to add country update functions so the zones are updated correctly on existing installations.

As this affects the Ukraine CIF we should consider #1469980: Crimea is missing in regions choice for Ukraine at the same time.

longwave’s picture

bcurry’s picture

Version: 7.x-3.x-dev » 7.x-3.6
Priority: Normal » Minor
Issue summary: View changes
Status: Needs work » Needs review
FileSize
1.39 KB

TR in post #2 had suggested that it might be a good idea to have CIF files list state/province info in the Latin character set as well as in the character set of the given country. For what it's worth, here is a Japanese CIF file I've prepared with Japanese prefectures listed twice. Once in the Latin character set and once in the Japanese character set.

The main reason for my post is to describe something I've observed on my site and what I did to fix it in case it applies to anyone else.

When I add the attached Japanese CIF file to my ubercart/uc_store/countries directory, the administrative section of my website (admin/store/settings/countries) will recognize the presence of the new CIF file and will place an update link next to Japan. When I click update, the version number increments and the update link disappears from the page. This would suggest that the new CIF file should be in effect now. However, the state/province link on my site does not contain the updated Japanese prefecture info.

In my case, the solution was to remove Japan from my list of countries. Once Japan is removed, an import link appears at the top of the page. The new CIF file is listed. If you select the CIF file for import, the new Japanese prefecture info will instantly be applied.

This also proved to be the solution to another problem with my site. Any non Latin characters in my collection of country CIF files were not being displayed correctly. I don't know if they had been that way ever since I installed Ubercart, or if the problem happened when I moved my site to a new webhost.

For example in the Italian CIF file I would see: Città del Vaticano instead of Città del Vaticano

In other countries, I'd see: Hamgyŏng-bukto instead of Hamgyŏng-bukto, and Рівненська область instead of Івано-Франківська область.

In cases where the name of the country had non-Latin characters those would be affected too. For example: Réunion instead of Réunion.

All of these issues were corrected simply by removing the country from my list and then re-importing it. I hope this info might help some others who find themselves in this situation.

TR’s picture

Status: Needs review » Needs work

Thanks.

The reason the update didn't work for your Japan CIF file is because you didn't include a japan_update() function in your new CIF. The install() function works only for sites where the country hasn't been installed yet. The update() function is where changes are made to countries that are already installed. Because you didn't include an update() function your new zones weren't defined when you did the update. Renaming zones, adding new zones, changing zone codes, etc. all has to be performed explicitly in the update() function. For examples of how to write an update() function, look at version 2+ of any of the .cif files in Ubercart.

For the other problem, it sounds like your DB export or DB import didn't preserve UTF-8 characters. That doesn't seem to be an Ubercart issue.

rakun’s picture

I have a client that have 40-80 international shipments monthly (they ship from USA). They have a issue with non roman characters for State/Province (Egypt, Russian Federation, China, etc..). This is problem defined by my client:

Sometimes we have to enter the international shipping address on the order. Some countries do not display the State correctly. If we need to enter "Beijing, China", we select China as the country and then we can't select the state as Beijing since it is in Chinese characters. So a correct address can't be entered.

Also we have problem with website orders: If a customer places the order via the website, most of them are fine with selecting "Beijing" or the Chinese character word. But, when the order comes into our system and we go to print and ship the order, our printer and shipping software does not know how to read the Chinese characters. (and we can't ship since we need to some how get the correct shipping state and country on the postage label) So we have to contact the customer and have them provide the English word "Beijing" to us.

Ubercart should provide interface for install/update country zones to English with a Latin character set along with original character set by default. This way we can have best of the both worlds.

longwave’s picture

@rakun: The files in #6 and #7 should do exactly that at install time, but not during updates. Maybe you can test this, and perhaps write a set of country update hooks so they work during updates as well?

rakun’s picture

Should I put some kind of notification in file name? For example russia_643_latin_3.cif so it can be different than original russia_643_2.cif characters.
I am thinking if we do the above, during Ubercart upgrade, I will not have to add these files to uc_store/countries again. Correct me if my thinking is wrong.

rakun’s picture

FileSize
7.82 KB

Attached .cif files for d7 and ubercart 3.x with update functions. China can not be updated, so only install option is available.

rakun’s picture

FileSize
7.85 KB

Above files have wrong version id in install function. These are fixed files.

TR’s picture

There is no need to change the file names as you proposed in #14.

Why can't China be updated?
Why are you updating the country name for all the countries? It doesn't look like you changed them.
You shouldn't remove the old update cases - they are still needed!

FLorina should be Florina in the Greece file.

I just took a quick look - I'll look into these in detail later.

I hid the file in #15.

Daniel.Moberly’s picture

FileSize
1.26 KB

Attaching a revised Japan country file with better name translations (Chiba rather than Tiba, Fukushima rather than Fukusima, etc.)