aliens

Author Topic: Translator feedback required  (Read 16683 times)

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Translator feedback required
« Reply #15 on: January 20, 2013, 01:03:23 pm »
This is exactly why this thread exists. In the code I use the rules for each language to look up special strings when a number is involved.

I have a way to specify the rules in code (and the rules for Russian are already there), exactly as you mention them.

If the special treatment is asked for a key based on a number n (eg STR_SOLDIERS_IN_CRAFT), the following are tried:
If n is 0 the STR_SOLDIERS_IN_CRAFT_0 is selected, if it exists. This happens for all languages.
Based on each language different rules are used, and one of keys STR_SOLDIERS_IN_CRAFT_1 to _K are selected, based on the language. _1, _2 and the rest may have different meaning for each language, they are NOT the number n. It is simply the k-form in the rules for the specific language. So, while English and French both use _1 and _2, for English _1 is used only for singular and _2 is used for plural and for zero (if _0 is not found). For French _1 is used for singular and as the zero fallback, while _2 is used for plural.

Please check the rules in the source code (file src/Engine/Language.cpp) it should be easy enough to understand the various "getSuffix" functions for the different languages.

The problem is that a lot of the strings are created from smaller pieces (eg words) and thus the actual game code needs to change to use the new translation facility and make sentenses that the translators can modify. As a fictional example:
Now the code is like:
Code: [Select]
message = translate("STR_THERE_ARE") + n + translate(n == 1 ? "STR_SOLDIER" : "STR_SOLDIERS") + translate("STR_IN_THE_CRAFT")
and the translators only see the "STR_" strings.

It should be changed to
Code: [Select]
message = translate("STR_THERE_ARE_N_SOLDIERS_IN_CRAFT", n)

and then the translator for (Rusian?) will see:
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_0
Some rusian for żołnierzy or sztuk
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_1
maybe {N} sztuka or {N} żołnierz
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_2
maybe some {N} sztuki or {N} żołnierzy
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_3
maybe some {N} sztuk or {N} żołnierzy

while the translators for French will see:
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_0
French for no soldiers in craft
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_1
French for a single soldier in craft
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_2
French for {N} soldiers in craft

And the English text will be:
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_0
No soldiers in craft
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_1
A single soldier in craft
STR_THERE_ARE_N_SOLDIERS_IN_CRAFT_2
{N} soldiers in craft

And if the _0 form is missing in English, the _2 form will be tried, but for French the _1 form will be tried.

Offline Fenyő

  • Colonel
  • ****
  • Posts: 423
    • View Profile
Re: Translator feedback required
« Reply #16 on: February 11, 2013, 07:57:44 pm »
@karvanit: Could you please take a look at the Hungarian plurality thing?
Something is wrong. When i land with a craft on an UFO, and immediately press Abort:
On the Mission Abort screen i see "STR_n_UNITS_IN_EXIT_AREA". :(
But it should show the correct string.
I've tried to debug it myself, but i have no luck.
In the language file i have both STR_n_UNITS_IN_EXIT_AREA_0 and STR_n_UNITS_IN_EXIT_AREA_1.
I really don't know what is the problem here...

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Translator feedback required
« Reply #17 on: February 11, 2013, 08:03:46 pm »
Are you SURE the language file with the variant strings is in the proper place?
Do you see any line mentioning STR_n_UNITS_IN_EXIT_AREA in the logs?
Can you also add a STR_n_UNITS_IN_EXIT_AREA_2 with a dummy value (eg "This should not appear EVER!") and check if you get that value?

I'm pretty much drowning at work right now, I won't be able to take a look before the weekend.
« Last Edit: February 11, 2013, 08:07:25 pm by karvanit »

Offline Fenyő

  • Colonel
  • ****
  • Posts: 423
    • View Profile
Re: Translator feedback required
« Reply #18 on: February 11, 2013, 08:13:39 pm »
Of course i tried _2. It had no effect. :(
This part of the language file is:
Code: [Select]
STR_SELECT_SQUAD_FOR_craftname
Válassz osztagot: {1}
STR_n_UNITS_IN_EXIT_AREA_0
{N} egység elhagyásra kész
STR_n_UNITS_IN_EXIT_AREA_1
{N} egység elhagyásra kész
STR_n_UNITS_OUTSIDE_EXIT_AREA_0
{N} egység elhagyásra nem kész
STR_n_UNITS_OUTSIDE_EXIT_AREA_1
{N} egység elhagyásra nem kész
STR_ABANDON_GAME_QUESTION
ABBAHAGYOD A JÁTÉKOT?


EDIT:
Quote
Do you see any line mentioning STR_n_UNITS_IN_EXIT_AREA in the logs?
Of course:
Code: [Select]
[11-02-2013 19:15:21] [WARN] STR_n_UNITS_IN_EXIT_AREA not found in Hungarian
« Last Edit: February 11, 2013, 08:17:13 pm by Fenyő »

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Translator feedback required
« Reply #19 on: February 11, 2013, 08:21:07 pm »
The string matching is verbatim, so can you re-type the ID strings in the language file, AFTER deleting the lines that contain them?
Like so:
1. Delete the line that reads "STR_n_UNITS_IN_EXIT_AREA_0".
2. Retype the STR_n_UNITS_IN_EXIT_AREA_0 in a new line at the proper place.
3 and 4. Do 1 and 2 for STR_n_UNITS_IN_EXIT_AREA_1.

If this works then some special characters got in the language file when I edited it. I don't really think it probable, but the code looks ok.

Offline Fenyő

  • Colonel
  • ****
  • Posts: 423
    • View Profile
Re: Translator feedback required
« Reply #20 on: February 11, 2013, 09:43:24 pm »
I've tried to replace the whole section(Copy-Paste) from the English.lng and leave the English strings, but the result is the same!

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Translator feedback required
« Reply #21 on: February 22, 2013, 09:24:00 pm »
Ok, the code is fixed and the PR is send. Thank you for spotting this.
The error was in the actual translation code, not in the language files.

Offline Fenyő

  • Colonel
  • ****
  • Posts: 423
    • View Profile
Re: Translator feedback required
« Reply #22 on: February 23, 2013, 04:03:07 am »
Thank you!