Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A string, for example "hello world" is set to be translated by calling a special function, named _ for GiD strings, and = for problemtype strings.
To call this function must enclose it with [ ], for example:
[_ "Hello Word"]
for a GiD script, or
[= "Hello Word"]
for a problemtype script
For a problemtype the source code is scanned to find [= ] instead [_ ]
It's possible to add to the string some special format % characters
set numfiles 3
[_ "Copied %d files" $numfiles]
If the source and the translated strings have different % format, the program using this translation can crash at runtime.
To avoid this situations there is menu:
Messages -> Check format
To search inconsistent (in format) translated sentences.
For example it's a bug to translate the sentence "Copied %d files" to "Copiados %f ficheros", because %d expect an integer, and %f expect a real number. The strings to be translated must be marked with the procedure _

Typically, to run it must be enclosed in square brackets: (this procedure is called at runtime, there is no pre-compilation)

In the case of being a "ProblemType" of GiD, instead of _ you have to use =, to be able to differentiate both environments.

For example:

Code Block
set to "hello world"


For GiD you should write:

Code Block
set a [_ "hello world"]


and for a "ProblemType":

Code Block
set to [= "hello world"]


Note: it is essential that there is one or more spaces between _ and the string.

If the project has been declared as GiD's "ProblemType", instead of tracing strings marked with [_], the ones with [=] will be searched.

The translation of the strings marked with [_] are the responsibility of theĀ GiD team developers, and must not be retranslated by the creator of a "ProblemType",
that is why they are marked differently.

Keywords should not be translated,
For example:

Code Block
.central.s process "escape geometry create point 3.5 2.8"

It should not be written as:

Code Block
.central.s process [_ "escape geometry create point 3.5 2.8"]