OpenTTD / eints

WebTranslator for OpenTTD and its add-ons
GNU General Public License v2.0
6 stars 10 forks source link

"Error: String parameter 0 may not be used for gender queries {G ..}" #67

Closed absay closed 2 years ago

absay commented 2 years ago

Already posted to the TT forums but I'll see if I have better luck here.

There's a string: STR_STATION_VIEW_RESERVED that has to be translated to Spanish (Mexican) as follows:

_{YELLOW}({CARGOSHORT} reservad{G 0 o a}{P 0 "" s} para cargar)

The output in the game should look something like this:

However, the tool complains with Error: String parameter 0 may not be used for gender queries {G ..}. Changing the index parameter to 1 doesn't work either, and removing the gender syntax and only leaving the plural one does work. What am I missing?

I already tried a similar syntax with STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED:

_{ORANGE}{CARGO_TINY}/{CARGOLONG}{RED} (todavía requerid{G 1 o a}{P 1 "" s})

And it came out without errors. I can sort of rephrase the translation as a workaround to avoid using genders in that specific string, but I'm more interested in knowing what's causing the G syntax to fail.

The documentation in the wiki is kind of confusing and seems incomplete, so I'd appreciate any help here. TIA.

nielsmh commented 2 years ago

I can't quite follow the code in OpenTTD and that handles gender selection for strings, but it ought to work assuming the cargo measurement name strings have a {GENDER x} marker in them. So this does sound like be a bug with eints rejecting something that should work.

glx22 commented 2 years ago

I'm not sure gender works for {CARGO_xxx} parameters, as it kind of expect a {STRING}. Also I can see a {G=f} for STR_TONS but none for any other (STR_PASSENGERS, STR_BAGS, STR_LITERS, STR_ITEMS or STR_CRATES)

glx22 commented 2 years ago

Ok I did a quick test and strgen errors out with Command 'CARGO_SHORT' can't have a gender (FATAL) if I put a {G} command in STR_STATION_VIEW_RESERVED. So eints is right here.

nielsmh commented 2 years ago

So eints is right that it doesn't work, meaning the strgen system is incompatible with Spanish.

absay commented 2 years ago

Appreciate the answers.

I'm not sure gender works for {CARGO_xxx} parameters, as it kind of expect a {STRING}.

Still, it works with {CARGO_LONG}, in the other translated string I gave as an example.

And yeah, {G=f} is missing from those types of cargo, it's one of the several fixes I intend to implement in the translation. However, based on your comments about eints' behavior, unless {CARGO_SHORT} accepts genders, it seems there would be no point in adding genders to those cargo types, would it?

So eints is right that it doesn't work, meaning the strgen system is incompatible with Spanish.

Spanish and a bunch of other gendered languages as well, I assume.

So, what's the best course of action here (besides possibly rephrasing the translation)? {CARGO_SHORT} outputs units that contain/refer to nouns, so gender is needed here.

glx22 commented 2 years ago

Ok I did a quick test enabling genders for {CARGO_SHORT} and it seems to work fine. Added {G 0 "m" "m2" "f"} to STR_STATION_VIEW_WAITING_CARGO and STR_STATION_VIEW_FROM_HERE. Added some {G=...} to STR_UNITS_WEIGHT_LONG_XXX (different gender for each one). The screenshots show the expected gender is used in the strings (using {CARGO_LONG} and {CARGO_SHORT}). image image image

I need to test more things to see if gender can be allowed for other things, but allowing gender for {CARGO_SHORT} seems possible.

absay commented 2 years ago

Sweet!

So would this require to post an issue to the OpenTTD project instead?