Post by kev82 » Sat Mar 10, 2012 1:57 am

I recently upgraded from 1.4.x to 1.5.x, and with all the new language files and new strings in existing language files I'm wondering what's the best way to synchronize the files without losing what I've already translated?

What I did originally is I copied the english folder, renamed it and translated all the strings. Obviously I can't do that again, or I'll have to translate everything again. What's the best way to update my translation to 1.5.x?


Edit:
See posts below for the script that upgrades language files.
Last edited by kev82 on Wed Mar 21, 2012 5:19 pm, edited 1 time in total.

New member

Posts

Joined
Fri Feb 27, 2009 6:34 am

Post by straightlight » Sat Mar 10, 2012 3:11 am

I recently done this as a custom job for a client and discovered the above conclusion. What I did is simply mass update the product description table and all tables relying on each languages ID in order to match with the updated language ID from the languages table. See, the language ID from the languages table is an auto-incremented field which during the upgrade isn't considered during the changes to re-validate all the languages ID when changes are involved.
Last edited by straightlight on Sun Mar 11, 2012 11:23 pm, edited 1 time in total.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by i2Paq » Sun Mar 11, 2012 11:04 pm


Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by kev82 » Tue Mar 20, 2012 8:43 pm

I created a quick python script that merges language files.

The way it works is you put it in the language folder and run it. It will create a folder called merged, which will contain all previous strings you've already translated, and adds the new strings (in english). Then it's a matter of going through the files in the merged folder and translate the english strings to your language.

I did this script rather quickly, so there's a few things it doesn't do:
It doesn't save comments. The outputted files will be void of comments
It doesn't remove strings no longer used
It doesn't let you know which files were changed

To use:
Put it in the language folder (normal or admin, it can do both)
Edit dir1 and dir2. dir1 is the one with the new strings (english), while dir2 is your language file that's missing some strings.
Run the script. It worked fine on windows and linux for me with python 2.7.
The script will create a merged folder that you will have to go through and translate the new strings.

I hope it's useful for someone.

http://pastebin.com/kXTxs72J
Last edited by kev82 on Tue Mar 20, 2012 9:16 pm, edited 1 time in total.

New member

Posts

Joined
Fri Feb 27, 2009 6:34 am

Post by kev82 » Tue Mar 20, 2012 9:15 pm

Did some more changes to the script:

It now removes strings that are no longer used
It lets you know which files have new strings (and what strings are new)

See here:
http://pastebin.com/6zJrqUHZ

Script takes about 1 second to run on my computer, so alot faster than doing this by hand :)

New member

Posts

Joined
Fri Feb 27, 2009 6:34 am
Who is online

Users browsing this forum: No registered users and 48 guests