Check trick for translation....

Discuss and coordinate development of mainline and user-made content translations.

Moderator: Forum Moderators

Post Reply
User avatar
Antro
Translator
Posts: 70
Joined: February 11th, 2009, 3:53 pm

Check trick for translation....

Post by Antro »

Hi there!

Today someone submitted some updates for italian translation regarding mainly bad variables translation ( i.e. "$number" in source and "$num" in translation, or any sort of mistake like that). This remind me and "old trick" to check this kind of errors:

Open an xterm (Yes, my home computer has no windows... if not, you can install mingw and use that shell...)
cd wesnoth/po/wesnoth-utbs
fgrep $ it.po

At the bottom of the output you can find something like

Code: Select all

#. [message]: speaker=$victim_id
#. [message]: speaker=$victim_id
msgid "No, $unit.name can’t die now!"
msgstr "No, $unit.name non deve morire adesso!"
msgid "+$amount XP"
msgstr "+$amount PE"
#~ "will just take $heat_damage damage per turn when flying over lava, though "
#~ "$heat_damage damage at the start of each turn. This heat damage can "
#~ "$temp_damage punti di danno per turno quando si librano sulla lava, ma "
#~ "caverna riceveranno $temp_damage punti di danno all’inizio di ogni turno. "

Now check the output: you can notice that $unit.name and $amount are correctly translated, but the last 4 lines state that $heat_damage was translated as $temp_damage....

P.S: Since in this example the strings are not used in translation ( the initial "#~" ) the translation is not affected, but I think that the trick is effective and worth to be shared.
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Check trick for translation....

Post by Elvish_Hunter »

Good job, Antro! ;)
Antro wrote: October 26th, 2021, 5:24 pm Open an xterm (Yes, my home computer has no windows... if not, you can install mingw and use that shell...)
cd wesnoth/po/wesnoth-utbs
fgrep $ it.po
I just want to add that this trick can be improved by combining it with the find and xargs commands. For example, if you cd your terminal into the wesnoth/po directory, find can look for every "it.po" file and xargs can pass those file names to fgrep (which by itself is equivalent to grep -F). Like this:

Code: Select all

wesnoth/po$ find -name it.po | xargs grep -Fn '$'
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Check trick for translation....

Post by octalot »

There's a tool that will do the string comparisons for you too :D . There's discussion of it in #4436.

https://github.com/stevecotton/i18nspector/tree/wesnoth_markup_language - I just pushed an update to the README (scroll down on that webpage to see a quickstart guide).
Post Reply