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] speaker=narrator message= _ "This string is going to be translated." [/message]
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 [event] #textdomain wesnoth-httt [message] message= _ "heir to the throne message" #this will be translated using the HttT textdomain [/message] [message] message= _ "heir to the throne message two" #same as above [/message] #textdomain wesnoth-utbs [message] message= _ "under the burning suns message" #UtbS textdomain [/message] [/event] [event] [message] message= _ "the rise of wesnoth message" #TroW textdomain [/message] [/event]
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.
[textdomain] name="wesnoth-Liberty" path="data/campaigns/Liberty/translations" [/textdomain]
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"