GiD - The personal pre and post processor
Typical errors
The string must be enclosed in quotation marks, to differentiate it from the arguments.
Wrong example:
set a [_ hello world]
The first parameter would be mistakenly taken as a string and the second as an argument.
Even if there is only one word, by convention we must enclose it in parentheses.
This error has typically appeared in the menu definition file (GrDataMenus.tcl), with cases like the following:
Incorrect:
set MenuEntries(0) [ list [_ New] [_ Open...] [ Save as...] ]
Correct:
set MenuEntries(0) [ list [_ "New"] [_ "Open"]... [ "Save as"]... ]
(Also note the detail of putting the three points outside the bracket to facilitate the translator task)
An English word can be converted to multiple words in another language, so tcl errors can be created at runtime:
Example:
Initially correct
button .b -command "puts perhaps"
Incorrect
button .b -command "puts [_ perhaps]"
Can be translated in Spanish like this:
button .b -command "puts tal vez"
Thus, two parameters are passed to the puts command instead of one, generating an error.
The correct thing would be
button .b -command [list puts [_ perhaps]]
The command _ must be executed by [], but if an expression is enclosed in braces {} there will be no substitution in Tcl.
For example:
set a { "delete all" "maintain" }
Must not be written as
set a { [_ "delete all"] [_"maintain"] }
Since the parenthesis prevents the evaluation, (after the translation would be the same as [_ "delete all"] [_ "maintain"])
It would be valid like this:
set a [list [_ "delete all"] [_ "maintain"]]
COPYRIGHT © 2022 · GID · CIMNE