TokPhobia
08-14-2009, 09:07 AM
Hello everyone!
As most of the people working on translations have probably noticed, patches sometimes change the stringtables by adding or removing lines. This means that you need to check (by hand or by using tools) which lines have been changed and modify your translated stringtables.
To help with this, I've whipped up a small Python script that does the job. The source code is attached to this post.
To use it, copy the new english stringtables and your old translated stringtables in the same directory as the script. Then, in your Python console type:
import updater
updateTables("ro")Of course you should replace "ro" with whatever language you're translating to ( in this case I used Romanian ). The script will create four new ( hopefully ) corrected stringtable files.
The script isn't very complex. It just takes each line from the english version and extracts its variable name. It then checks the translated version for a line with the same variable name. If it finds it, it copies the line from the translated version. If it doesn't find it, then the line is new so it copies it from the english version. Lines from the translated version that have been deleted in the patch are never copied.
Disclaimer: The script still needs more testing ( on more files than just mine ) so it might not work as expected. Also, you should backup your files before using it, just in case. Finally, use it at your own risk ( I won't be responsible if the computer turns into a fireball or any other damage it might cause ).
Hope you guys find it useful and I await your feedback!
As most of the people working on translations have probably noticed, patches sometimes change the stringtables by adding or removing lines. This means that you need to check (by hand or by using tools) which lines have been changed and modify your translated stringtables.
To help with this, I've whipped up a small Python script that does the job. The source code is attached to this post.
To use it, copy the new english stringtables and your old translated stringtables in the same directory as the script. Then, in your Python console type:
import updater
updateTables("ro")Of course you should replace "ro" with whatever language you're translating to ( in this case I used Romanian ). The script will create four new ( hopefully ) corrected stringtable files.
The script isn't very complex. It just takes each line from the english version and extracts its variable name. It then checks the translated version for a line with the same variable name. If it finds it, it copies the line from the translated version. If it doesn't find it, then the line is new so it copies it from the english version. Lines from the translated version that have been deleted in the patch are never copied.
Disclaimer: The script still needs more testing ( on more files than just mine ) so it might not work as expected. Also, you should backup your files before using it, just in case. Finally, use it at your own risk ( I won't be responsible if the computer turns into a fireball or any other damage it might cause ).
Hope you guys find it useful and I await your feedback!