From The Battle for Wesnoth Wiki

This page describes tags and syntax used for enabling translation in your user made campaign.


_ "<translatable string>"

Any string that you want to be translatable needs to be prefixed with an underscore, US-ASCII 0x5F. It will usually also be enclosed in quote marks. Example:

    message= _ "This string is going to be translated."

#textdomain <textdomain>

This comment tells Wesnoth to use a certain textdomain. Affects the tag that it has been placed in and all children until another #textdomain is found. A textdomain is a set of translations(you can create your own one for your campaign). Example:

#textdomain wesnoth-trow
  #textdomain wesnoth-httt
    message= _ "heir to the throne message" #this will be translated using the HttT textdomain
    message= _ "heir to the throne message two" #same as above

  #textdomain wesnoth-utbs
    message= _ "under the burning suns message" #UtbS textdomain

    message= _ "the rise of wesnoth message" #TroW textdomain

Note: The [scenario] tag isn't a child of [campaign], so you will have to specify a textdomain for both, your campaign and each of your scenarios.

the [textdomain] tag

This tag, which has to be placed at the same level as [campaign], is used to specify a path for your own textdomain.



Functional Characteristics

Hidden Text

Presence of the circumflex (^), US-ASCII 0x5E, in any text string which is translatable — i.e. processed by the functions of src/tstring.cpp — causes the circumflex and any text preceeding it to be ignored; any such text is therefore not shown in the GUI. This can be used to provide translators with informative messages because, of course, such text is retained in the original value. More importantly, it also serves to distinguish strings which are the same in English but would differ in other languages - for example, if a string is used both for male and female units.

Examples of this are seen throughout the mainline assets. Most often, it is used when a name is purposed for an object of certain gender and when that gender is not obvious by the text of the name itself.
Used in a [side] key:

   user_team_name= _ "teamname^Southeast"

Used in a [race] key:

   female_name= _ "race+female^Bat"

See Also

This page was last edited on 29 December 2017, at 03:03.