Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
absay opened this issue Apr 23, 2022 · 7 comments · Fixed by #68
Closed

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

absay opened this issue Apr 23, 2022 · 7 comments · Fixed by #68

Comments

@absay
Copy link

absay commented Apr 23, 2022

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}({CARGO_SHORT} reservad{G 0 o a}{P 0 "" s} para cargar)

The output in the game should look something like this:

  • 1 artículo reservado para cargar (male gender, singular)
  • 2 artículos reservados para cargar (male gender, plural)
  • 1 caja reservada para cargar (female gender, singular)
  • 2 cajas reservadas para cargar (female gender, plural)

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}/{CARGO_LONG}{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
Copy link

nielsmh commented Apr 23, 2022

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
Copy link
Contributor

glx22 commented Apr 23, 2022

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
Copy link
Contributor

glx22 commented Apr 23, 2022

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
Copy link

nielsmh commented Apr 23, 2022

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

@absay
Copy link
Author

absay commented Apr 24, 2022

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
Copy link
Contributor

glx22 commented Apr 24, 2022

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
Copy link
Author

absay commented Apr 25, 2022

Sweet!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants