News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Variables/Parameters in translation texts

Started by Leartin, November 14, 2019, 03:21:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leartin

Based on a discussion in the german forum

I think it would be useful if translation texts could refer to game variables.
The city dialog help states that there is a set treshold for inhabitants in a city that cause a new factory to spawn. It also states the name of the parameter. However, if I was a new player, I'd rather have it tell me "New factories spawn every X inhabitants". For this, it would be required that the game changes "spawn every #%industry_increase_every%# inhabitants" by replacing the parameter by the value it's set to. Ideally, those would have their own color and show the parameter name at mouseover.

Bonus points for enabling cases. [Capacity of goods, pax and post is #%separate_halt_capacities 0="added together" 1="seperated"%#.]

I'm pretty sure with all the various options Simutrans has, without this most help texts are bound to be either incomplete, wrong, or TLDR. No player would want to read about all those possible options when they need help with the game they are playing at that moment.
Plus, as far as I know there is no simple, save way to look at the options in a running game. Using the help files to show all options as they are set without being able to change them could help troubleshooting for other players.

Ters

Translations can only access the variables that are explicitly passed to it by the code, and then they must access them in the exact same order. Typical translation implementations slightly more advanced than what Simutrans does/uses will allow them to access them in any order, but still limited to exactly those variables the game wants to show. Making any variable available will require such extensive work that I consider it unlikely that anyone will have the time and will to include it in Simutrans. It will also be somewhat expensive in terms of performance.

Dwachs

It is possible to use positional parameters: if master text is "bla %d blub %d", then translation can reorder them to "foo %2$d foooo %1$d". If one does this, then for all parameters the numbering scheme should be used. The syntax is

%[number]$[type]

where 'number' specifies, which of the arguments is taken here, 'type' is the rest of the format specifier. 'number' is from 1 to number of arguments.
Parsley, sage, rosemary, and maggikraut.

Ters

I thought the functions called printf worked like printf, but apparently, they don't. It is still a far cry from what Leartin wants.

Leartin

It is a far cry, yes. Especially since it originated from the ingame help, which - to my knowledge - does not have a master text. Even if it did, I doubt it would be a good idea to mess with the master.