Difference between revisions of "TranslationsWML"

From The Battle for Wesnoth Wiki
(Categorize)
(Hidden Text: Add in the more important reason to use the circumflex)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
This page describes tags and syntax used for enabling translation in your user made campaign.
 
This page describes tags and syntax used for enabling translation in your user made campaign.
  
== _ "<translatable string>" ==
+
== Components ==
Any string that you want to be translated has to be put inside _ " ".
+
 
 +
=== _ "<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:
 
Example:
 
  [message]
 
  [message]
Line 9: Line 12:
 
  [/message]
 
  [/message]
  
== #textdomain <textdomain> ==
+
=== #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).
 
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:
 
Example:
Line 36: Line 40:
 
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.
 
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 ==
+
=== 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.
 
This tag, which has to be placed at the same level as [campaign], is used to specify a path for your own textdomain.
Line 45: Line 49:
 
     path="data/campaigns/Liberty/translations"
 
     path="data/campaigns/Liberty/translations"
 
  [/textdomain]
 
  [/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.  <br />
 +
Used in a '''[side]''' key:
 +
    user_team_name= _ "teamname^Southeast"
 +
Used in a '''[race]''' key:
 +
    female_name= _ "race+female^Bat"
 +
 +
== See Also ==
 +
 +
* [[SyntaxWML]]
  
 
[[Category:WML Reference]]
 
[[Category:WML Reference]]

Latest revision as of 03:03, 29 December 2017

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

Components

_ "<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]

#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
[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.

Example:

[textdomain]
   name="wesnoth-Liberty"
   path="data/campaigns/Liberty/translations"
[/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.