GAE is able to translate every string in a techtree, thus allowing you to make an entire mod multilingual. In addition, it can specify tooltips for each unit (also translatable) which can give a short summary of the unit when their icon is hovered over.
Language files[]
There are two types of language files that are used to translate mods. The first is the techtree language file, and is located in techtree_name/lang/ and will be named techtree_name_language.lng. For example, in Magitech, it would be named magitech/lang/magitech_en.lng (en is the short code for English, see Language codes below for a full list of the language codes). This file would contain the strings for the resources, faction names, attack type names, and armor type names.
The second language file is located in techtree_name/factions/faction_name/lang/ and would be named faction_name_language.lng. For example, in the Magic faction, it would be named magitech//factions/magic/lang/magic_en.lng. This file contains all of the faction's translations, including unit names, upgrade names, unit and upgrade tooltips, command names, and level names.
Both of these will be explained in detail later on this page (see Techtree language file and Faction language file).
Language codes[]
As follows is the list of language codes for different languages (or varients of them) which can be used when translating. A language file would end with the code on the left (the text to the right of the equal sign is the full name). Excerpt from langlist.txt:
af=Afrikaans
an=Aragonese
ar=Arabic
as=Assamese
ast=Asturian
az=Azeri
be=Belarusian
ber=Amazigh
bg=Bulgarian
bn=Bengali
bo=Tibetan
bokmal=Norwegian, Bokmål
br=Breton
bs=Bosnian
byn=byn
ca=Catalan
crh=Crimean Tatar
cs=Czech
csb=Kashubian
cy=Welsh
da=Danish
de=German
dz=Dzongkha
eesti=Estonian
el=Greek
en=English
es=Spanish
et=Estonian
eu=Basque
fa=Persian
fi=Finnish
fil=Filipino
fo=Faroese
fr=French
fur=Furlan
fy=Frisian
ga=Irish
gd=Scots Gaelic
gl=Galician
greek=Greek
gu=Gujarati
gv=Manx Gaelic
ha=Hausa
he=Hebrew
hi=Hindi
hne=Chhattisgarhi
hr=Croatian
hsb=Upper Sorbian
ht=U006Breyol
hu=Hungarian
hy=Armenian
id=Indonesian
ig=Igbo
ik=Inupiaq
is=Icelandic
it=Italian
iu=Inuktitut
iw=Hebrew
ja=Japanese
ka=Georgian
kk=Kazakh
kl=Greenlandic
km=Khmer
kn=Kannada
ko=Korean
ks=Kashmiri
ku=Kurdish
kw=Cornish
ky=Kyrgyz
lg=Luganda
lo=Lao
lt=Lithuanian
lv=Latvian
mai=Maithili
mg=Malagasy
mi=Maori
mk=Macedonian
ml=Malayalam
mn=Mongolian
mr=Marathi
ms=Malay
mt=Maltese
nan=Minnan
nb=Norwegian, Bokmål
ne=Nepali
nl=Dutch
nn=Norwegian, Nynorsk
no=Norwegian, Bokmål
nr=Southern Ndebele
nso=Northern Sotho
oc=Occitan
or=Oriya
pa=Punjabi
pl=Polish
pt=Portuguese
ro=Romanian
ru=Russian
rw=Kinyarwanda
sa=Sanskrit
sc=Sardinian
sd=Sindhi
se=Northern Saami
shs=Secwepemctsin
si=Sinhala
sk=Slovak
sl=Slovenian
sq=Albanian
sr=Serbian
ss=Swati
st=Sotho
ta=Tamil
te=Telugu
tg=Tajik
th=Thai
tk=Turkmen
tl=Tagalog
tn=Tswana
tr=Turkish
ts=Tsonga
tt=Tatar
ug=Uyghur
ur=Urdu
uz=Uzbek
ve=Venda
vi=Vietnamese
wa=Walloon
wo=Wolof
xh=Xhosa
yi=Yiddish
yo=Yoruba
zh=Chinese
zu=Zulu
Translating basics[]
In language files, the keyword is on the left of an equal sign, being the constant value that is always the same, and the translated string is on the right of the equal sign, and will appear exactly as show in the game (including case, with a few exceptions where proper sentence case will automatically be done). For example:
keyword=Translated string!
In this above example, the keyword is "keyword", and in game, you'd just see "Translated string!". A keyword might be "PlayNow", which is the keyword for the button in the custom game and scenario menus which lets you begin the game. In english, the translated string is "Play now!", so in the language file, this looks like:
PlayNow=Play now!
Comments can be inserted into language files by starting the line with a semicolon (;). Each new line of the file is a new translation string, blank and comment lines ignored.
Types of language files[]
Techtree language file[]
The techtree language file contains just a few basic things, the resources, faction names, attack types, and armor types. The key words for all of these are exactly as they appear in the XMLs and folders, so if you have a gold resource (which means you should have a folder and corresponding XML named "gold" in the resource's folder), that would be the keyword.
For example, Magitech's language file would have to translate the name of the tech faction, which would look like this in the english language file:
tech=Tech
Faction language file[]
Factions are where more versatility comes in. Unit names, upgrade names, command names, tooltips, and level names would all appear in this file. Unit names, upgrade names, and level names would all be taken as they appear in the XML, so if you have a unit named "swordman", then that would be a keyword in the language string. Tooltips, however, are added in slightly differently, as explained below.
Tooltips[]
Tooltips are "descriptions" which appear when hovering over a command button. By default, GAE displays information about the command (for example, hovering over an attack command might show the strength of the attack command). The tooltips detailed in this section allow you to add a description to these mouse-overs.
Usage[]
Tooltips can be added to any command via its name element, by giving it a tip attribute (eg, <name value="move" tip="tooltip_name" />). The engine will look up the name passed into the tip attribute in the faction language file and display that as the tooltip.
Some commands can create a submenu (namely build, produce, morph, and upgrade), and each option in the submenu can be given its own tooltip. To do this, the tip attribute is instead placed on tags varying with the command:
Command | tip attribute location |
---|---|
build | <building name="building_name" tip="tooltip" /> |
produce | <unit name="unit_name" tip="tooltip" /> |
morph | <unit name="unit_name" tip="tooltip" /> |
upgrade | <upgrade name="upgrade_name" tip="tooltip" /> |
These commands which use a submenu are also capable of changing the sub-header displayed at the top of a tooltip. For example, by default (when unmodified), on a build command, the subheader would read "Build %s", where "%s" is the name of the building to build. With the sub-header attribute, you can specify a keyword in the language file to use as an alternative to the default. In the language file, "%s" will be replaced with the name of the unit, building, or upgrade appropriate to the command.
Examples[]
Single tip[]
In this example, a tooltip is added to an attack command.
<command>
<type value="attack" />
<name value="attack" tip="my_attack_tooltip" />
<image path="images/attack.bmp" />
<unit-requirements />
<upgrade-requirements />
<move-skill value="move_skill" />
<attack-skill value="attack_skill" />
</command>
Thus, "my_attack_tooltip" is now the keyword for the tooltip of this command. In the language file, we can reference that keyword and give it some proper text, eg:
my_attack_tooltip=The unit will attack a foe with frenzy fury.
Multiple tips[]
For build commands which give multiple building choices, you can specify different tooltips for each building by giving the building tags a tooltip, such as in the example below:
<command>
<type value="build" />
<name value="build" />
<image path="images/build.bmp" />
<unit-requirements />
<upgrade-requirements />
<move-skill value="move_skill" />
<build-skill value="build_skill" />
<buildings>
<building name="building1" tip="building1_tip" />
<building name="building2" tip="building2_tip" />
</buildings>
<start-sound enabled="false" />
<built-sound enabled="false" />
</command>
Multiple tips with sub-headers[]
For the two click system for buildings, you can also specify a subheader, which will be the header at the top of the tooltip, by default the command name, but the "%s" value will be replaced with the building's name, so you could, for example, use a subheader of "Build %s" so that the tooltip header for building1 would say "Build Building1", not just "Build". This is done as seen below:
<command>
<type value="build" />
<name value="build" />
<image path="images/build.bmp" />
<unit-requirements />
<upgrade-requirements />
<move-skill value="move_skill" />
<build-skill value="build_skill" />
<buildings>
<building name="building1" tip="building1_tip" sub-header="build_subheader" />
<building name="building2" tip="building2_tip" sub-header="build_subheader" />
</buildings>
<start-sound enabled="false" />
<built-sound enabled="false" />
</command>
And the language file would get:
build_subheader=Build %s
As an outcome, you would have the header "Build Building1" for the first building.
Further examples[]
GAE's Shibboleth techtree which defaultly comes with testing versions and can be downloaded from the Git repository, contains many examples for language strings and provides many real examples. Shibboleth can be obtained by downloading the source code.