/
Specifying the index of the tcl-formatted parameter

GiD - The personal pre and post processor

Specifying the index of the tcl-formatted parameter

When translating, sometimes the order of the words is rearranged.
For example, it may be syntactically desirable to rearrange the structure of a sentence in translation.

[_ "In %s there are %i inhabitants" $city $inhabitants]

It could be translated by a Spanish translator reordered like this, and become an error:

[_ "Hay %i habitantes en %s" $inhabitants $city]

In the translation only the string in quotes is modified, not the order of the parameters, and become an error. To control this, it is possible to add the index to which a format specification corresponds to the string:


For example:

[_ "In %1\$s there are %2\$i inhabitants" $city $inhabitants]


And the Spanish translator could provide this translation that have the arguments ok:

[_ "Hay %2\$i habitantes en %1\$s" $city $inhabitants]

Related content

COPYRIGHT © 2022 · GID · CIMNE