Translatable

From The Battle for Wesnoth Wiki
Revision as of 17:38, 1 August 2016 by Celtic Minstrel (talk | contribs) (Fix examples again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Explanation

Items marked with the text (translatable) are WML strings that can be translated. Nearly every string that the player sees can be translated. A program called "gettext" automatically parses your WML files, seeks out strings marked as translatable, and compiles them into a translation template file. Translators can then use this file to create translations of the game into their languages.

You, the scenario writer, must mark a string as translatable by including an underscore character "_" before the string starts. Here is an example.

Not translatable:
description="Baldras"
Translatable:
description= _ "Baldras"

When using strings in macros, include the underscore character with the actual text. Gettext does not know how to perform macro or variable substitution, so always keep the underscore with the string it marks.

Bad:

{VARIABLE message_text ("Hello, fair warrior!")}
[message]
message= _ "$message_text"
[/message]

Good:

{VARIABLE message_text ( _ "Hello, fair warrior!")}
[message]
message=$message_text
[/message]

See Also

This page was last edited on 1 August 2016, at 17:38.