Code: Select all
./check/st-tool.py sync default/stringtables/en.txt default/stringtables/es.txt > default/stringtables/es.new.txt
mv default/stringtables/es.new.txt default/stringtables/es.txt
meld default/stringtables/en.txt default/stringtables/es.txt
If the st-tool sync command copied the English values along the time of syncing it would be easy to work directly and only with the es.txt file. So, instead of
Code: Select all
#*SHIP_NAME_OTHER
#* <not translated 2015-04-15 19:23:23>
Code: Select all
#*SHIP_NAME_OTHER
#*Eternal September <not translated 2015-04-15 19:23:23>
Now I want to try adrian_broher's editor (WIP) instead of meld, but first I want to "save" the work I've done up to now.
To see where I am, I first do
Code: Select all
freeorion$ ./check/st-tool.py compare default/stringtables/en.txt default/stringtables/es.txt
default/stringtables/es.txt:24: Value of key 'OK' is identical to reference file default/stringtables/en.txt:24
[...]
default/stringtables/es.txt:203: Key 'NEW_ASTEROIDS_SUFFIX' contains translation for pure reference in reference file value default/stringtables/en.txt:203
[...]
default/stringtables/es.txt:387: Value of key 'SD_SCOUT_2' is older than reference file value default/stringtables/en.txt:387
[...]
default/stringtables/es.txt:447: Value of key 'SD_ROBOTIC_OUTPOST' has no translation compared to reference file default/stringtables/en.txt:447
[...]
default/stringtables/es.txt:19348: Value of key 'MONSTER_NAMES' has no translation compared to reference file default/stringtables/en.txt:19352
Summary comparing 'default/stringtables/es.txt' against 'default/stringtables/en.txt':
Keys translated - 4286/4286 (100.0%)
Keys not in reference - 0
Value is reference - 15
Values layout mismatch - 1
Values older than reference - 16
Values untranslated - 2905
Values same as reference - 38
So I can see
- the values that I have copied identical to the English ones (to be removed): en.txt "OK" -> es.txt "OK"
- the values that I have copied that are "pure reference" (to be removed??): en.txt [[PT_ASTEROIDS]] -> es.txt [[PT_ASTEROIDS]]
- the entries that I have left unchanged but that could still be the right translation: en.txt "" -> es.txt "Explorador II"
- the entries copied in the es.txt file by the st-tool sync command that I have not translated:
Code: Select all
#*SD_ROBOTIC_OUTPOST #* <not translated 2015-12-07 10:50:43>
The 1st (and 2nd, right?) cases are to be removed. Can the st-tool remove identical translations and pure references? Which would be the command?
The 4th case have thousands of cases, and it seems obvious they should not go into a PR to merge into master. What is the st-tool command to remove the synced untranslated entries?
The 3rd cases I want to leave them as they are. If I do whatever I'm told to solve the other cases, the old entries won't be lost, right?
Final doubt, I tried st-tool.py check, which was helpful to detect some errors I had (like translating some values but leaving its keys commented). But I don't understand the following error message:
Code: Select all
freeorion$ ./check/st-tool.py check default/stringtables/es.txt
Traceback (most recent call last):
File "./check/st-tool.py", line 587, in <module>
sys.exit(args.action(args))
File "./check/st-tool.py", line 477, in check_action
for match in re.finditer(INTERNAL_REFERENCE_PATTERN.format('.*?'), entry.value):
File "/usr/lib/python3.6/re.py", line 229, in finditer
return _compile(pattern, flags).finditer(string)
TypeError: expected string or bytes-like object
I suspect it means in the es.txt I'm working on. But in which line? It has 19357 lines now.
Please notice this is still the es.txt file with thousands of "#* <not translated ..." entries.
Finally, the help message for the st-tool could be more informative:
Code: Select all
freeorion$ ./check/st-tool.py -h
usage: st-tool.py [-h] {format,sync,rename-key,check,compare} ...
positional arguments:
{format,sync,rename-key,check,compare}
format format a string table and exit
sync synchronize two string tables and exit
rename-key rename all occurences of a key within a stringtable
and exit
check check a stringtable for consistency and exit
compare compare two string tables and exit
optional arguments:
-h, --help show this help message and exit
I can try that and figure out by myself, but it's helpful for dummies to know all of that in advance (In fact I did figured it out, but doing "strange" things first like copying the es.txt to a temporal file, fearing that format could do something to it I don't wont, which cause st-tool to throw error messages such as "fatal: no such parth es_tmp.txt in HEAD" plus the traceback, then I kept the tmp file just in case and called st-tool format upon the es.txt file, which outputed the formated file into stdout, and finally I invoked the command as it should be, redirecting the output to a temporal file).
The same applies for all other commands. It might not be obvious to newcomers when you compare two files which one is the reference, or that you need to redirect the output of of the sync command to a new file (I got no trouble with those since Marcel told me the exact commands in this thread, but yo get the point).