I am trying to complete translating my site into Chinese. We have installed the drupal 6 Chinese translation file by untaring the .po files. The basic Chinese that is in this package shows up but the custom strings we translated I cannot get to work. We are using the following modules:

Block translation 6.x-1.0
Content type translation 6.x-1.0
Internationalization 6.x-1.0
Menu translation 6.x-1.0
Profile translation 6.x-1.0
Registration language 6.x-1.5
String translation 6.x-1.0
Synchronize translations 6.x-1.0
Taxonomy translation 6.x-1.0

Localization client 6.x-1.6
Translation helpers 6.x-1.x-dev
Locale 6.10

I thought the process for this would be like the following:

# Go to admin/build/translate/export and export each translation from Built-in interface to Taxonomy downloading to desktop
# Open files in poedit and translate each string then save
# Go to admin/build/translate/import and for each .po file choose the text group and file importing with "Existing strings are kept, only new strings are added"
# Then clear the cache to make sure all blocks such are updated with translated strings.

When I do this procedure I do not get updated strings.

If I do an export to a .po file of say the taxonomy terms with. The translations I get duplicate entries for the same term, one is translated one is not. The only difference between the two is the number tabs between the "#:" and "term".

#: term:341:name
msgid "Restaurants"
msgstr ""

#: term:341:name
msgid "Restaurants"
msgstr "餐饮"

If I do a search on the database admin/build/translate/search then I get see two entries for the same taxonomy term one has a line through the "zh-hans" text like it has been deleted but there is still a delete menu next to it. If I choose the delete menu there I still do not see the translation.

I have found the translation documentation online to be very confusing so I would really appreciate some help on this.

Comments

deverman’s picture

Hey anybody looking at this forum I could really use some help?

gábor hojtsy’s picture

Are these duplicate entries before the site is translated, when the templates are exported but before you open in poedit?

deverman’s picture

I used the "Export translation" command to export the Chinese translations (Not Export template command).

After exporting taxonomy, menues etc, I gave to the files to a translator. She opened them in poedit and translated most items. She saved the files and then copied them back to my computer.

I then used the import function to upload the menus, taxonomy, etc. to the Chinese language.

From my memory there was one time when this worked and some of the menus changed their language when on a Chinese url but we didn't translate everything then.

There were additions to the translation table. So I did an export of all the translation categories again and gave them to the translator. She translated more items and sent the files back to me.

I believe after uploading a second time was when I noticed the problem of the menus not being translated anymore. I tried different variations on the import but with no success.

Now when I export the translation I get a file which has two entries for each item one with a translation and one without. If I open the file in BBedit I can search and find the duplicate entry. It also shows up in POEdit as it seems that program doesn't have the capability to remove duplicates.

I am using poedit for Mac and I have checked things such as line breaks and they seem correct. There is just a slight difference with white space on the two entries in the exported file as mentioned in my original post.

Here is a search for "My Inbox". See two entries for "item:383:title". The bottom entry is crossed out in the search but I think it is still active because it is the entry which does not have the chinese translation.

Text group String Languages Operations
Menu My Inbox
item:383:title zh-hans edit delete
Built-in interface My Inbox
zh-hans edit delete
Menu My Inbox
item:383:title zh-hans edit delete

deverman’s picture

I'm still looking for a solution to this how do normal people translate their sites if poedit is not a reliable option?

deverman’s picture

Maybe this problem is related to the one here?

http://drupal.org/node/425276

I just tried to use the ajax translation interface to make a test and my test translation was not saved. :-(

mvc’s picture

I believe this is caused by #384794: Preceding white space inserted in locales_source. If you're still having this problem, please help by reviewing the patch I posted there.

To fix your site, first apply that patch.

After that, you would ideally revert to a copy of your database from before you first imported a .po file, and import the .po files again.

If this is not possible, you could follow these steps (after backing up your database):

1. Export the affected strings again into a .po file (for example, all Chinese strings in the taxonomy text group)

2. Delete the strings with an extra space in locales_source.location from your database. For example, if the affected strings are in the taxonomy text group, you would do this: (note the space before the word term!)

DELETE FROM locales_target WHERE lid IN (SELECT lid FROM locales_source WHERE location LIKE ' term:%');
DELETE FROM locales_source WHERE location LIKE ' term:%';

3. Delete strings with an empty translation from locales_target. For example, if the affected strings are in the taxonomy text group:

DELETE FROM locales_target WHERE lid IN (SELECT lid FROM locales_source WHERE location LIKE 'term:%') AND LENGTH(translation) = 0;

4. Import the .po file again into the same language and text group, selecting the option "Strings in the uploaded file replace existing ones, new ones are added". This should ignore the empty duplicate entries in the .po file and just import those which have content. By choosing to replace existing strings, the remaining empty translations should be overwritten.

This worked for me. Good luck!