Translations.wiki
author Wuzzy
Thu, 21 Sep 2017 00:04:14 +0100
changeset 1026 1a9e923f1c1b
parent 1024 f243d261e679
child 1034 f55656ceb224
permissions -rw-r--r--
GearTypes: add default gtCase Power
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
     1
#summary This is a guide for new translators.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
     2
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
     3
= Translations =
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
     4
== Introduction ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
     5
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
     6
This is a guide for translators. In order to translate Hedgewars into another language you are going to need:
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
     7
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
     8
 # The latest Hedgewars localization files
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
     9
 # A text editor like Notepad++, Geany, Vim, etc.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    10
 # Qt4 Linguist. To download the Qt4 Linguist you have to download the Qt4 SDK.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    11
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
    12
== Getting the localization files ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    13
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    14
To get the Hedgewars localization files there are 4 possible ways.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    15
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    16
 * *A*. Clone the Hedgewars source repository.
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    17
 * *B*. Download the latest Hedgewars source code.
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    18
 * *C*. Find the localization files in your current Hedgewars installation.
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    19
 * *D*. Download only the specific files to be translated.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    20
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    21
The *A* is maybe the most convenient way to include the translations in the next Hedgewars release as you can easily produce a patch to provide it to the Hedgewars developers. Note that a fast internet connection is desired as you probably will clone the whole game sources. The other advantage of this way is that it can be used to translate the latest game version that is going to be released.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    22
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    23
The *B* way is a lot like the *A* way but more limited.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    24
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    25
The *C* is probably the fastest way and the more convenient for the translator.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    26
However, it has the limitation that one can only translate the most recent Hedgewars release (the one currently installed) and not the version that is going to be released.
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    27
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 751
diff changeset
    28
The *D* way is to download the desired files from [https://hg.hedgewars.org/hedgewars/raw-file/default/share/hedgewars/Data/Locale/ here].
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    29
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    30
Above I am going to discuss the *C* way (Find the localization files in your current Hedgewars installation).
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    31
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
    32
=== Finding the localization files ===
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    33
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    34
In GNU/Linux you have to look into `/path-to-Hedgewars/Data/Locale where path-to-Hedgewars` is the path to your Hedgewars installation.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    35
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    36
In Windows you have to look into `c:\path-to-Hedgewars\share\Hedgewars\Data\Locale` where path-to-Hedgewars is the path to your Hedgewars installation.
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    37
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    38
For example in an Arch Linux box the path is `/usr/share/Hedgewars/Data/Locale`.
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    39
In a Windows 8 box the path is `C:\Program Files (x86)\Hedgewars 0.9.19\Data\Locale`.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    40
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
    41
== Translation files ==
922
6d9246385399 Translations: Mention text editors
Wuzzy
parents: 921
diff changeset
    42
Here is a list of the different localization files of the English language that you should use as your translation reference/template as it should be the most accurate and up to date. The file locations are relative to the top directory of the Hedgewars source code. You can edit all these files with a text editor, but for some files special editors are available.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    43
923
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    44
=== Engine (in-game stuff) ===
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    45
 * `/share/hedgewars/Data/Locale/en.txt`—This contains the core in-game strings, such as the mission panel, the messages at the top, ammo names and descriptions
1024
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    46
 * `/share/hedgewars/Data/Locale/stub.lua`—Strings used by Lua scripts, which includes campaigns, missions and game styles (see below)
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    47
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    48
==== .lua files ====
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    49
In a `.lua` file you will find many lines like this:
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    50
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    51
```["Rubber Band"] = "", -- Construction_Mode```
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    52
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    53
Those need to be translated. The part in square brackets is the English original text.
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    54
The part in the quotation marks after the equals sign is supposed to contain the translation.
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    55
The part after the two dashes is a comment to provide context. It is only present for orientation, you do not need to translate it, you can also remove it. In this example, it means that the text comes from the Construction Mode script.
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    56
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    57
Example for a translated line (in Italian):
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    58
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    59
```["Rounds Complete"] = "Round Completati",```
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    60
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    61
Lines which look different than the lines described above have a special meaning and must not be changed.
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    62
In case you need to include a quotation mark in your translation, write `\"` instead of `"`.
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    63
Lines beginning with two dashes can be ignored.
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    64
f243d261e679 Translations: Explain .lua files
Wuzzy
parents: 976
diff changeset
    65
Note to programmers: These `.lua` files are actually containing real Lua source code.
923
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    66
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    67
=== Frontend (main menu) ===
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    68
 * `/share/hedgewars/Data/Locale/hedgewars_en.ts`—Contains most strings of the frontend and you can edit it with Qt Linguist
670
32fdba27f330 Another translation files update
Wuzzy
parents: 669
diff changeset
    69
 * `/share/hedgewars/Data/Locale/missions_en.txt`—This is the [Missions mission] description strings
32fdba27f330 Another translation files update
Wuzzy
parents: 669
diff changeset
    70
 * `/share/hedgewars/Data/Locale/campaigns_en.txt`—This is the campaign description strings
32fdba27f330 Another translation files update
Wuzzy
parents: 669
diff changeset
    71
 * `/share/hedgewars/Data/Locale/tips_en.xml`—This contains the tips shown in the main menu. This file is *not* in XML format!
669
a9110bd62394 Add metadata files
Wuzzy
parents: 592
diff changeset
    72
923
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    73
==== Mission map descriptions ====
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    74
The map selection shows brief descriptions for mission maps below the preview image. Those can be translated and you find those texts in:
883
54d163c108c1 Translations: mention mission map files
Wuzzy
parents: 798
diff changeset
    75
54d163c108c1 Translations: mention mission map files
Wuzzy
parents: 798
diff changeset
    76
 * `/share/hedgewars/Data/Maps/<map name>/desc.txt`
54d163c108c1 Translations: mention mission map files
Wuzzy
parents: 798
diff changeset
    77
975
c725521d6249 Translations: Simplify mission map desc stuff
Wuzzy
parents: 974
diff changeset
    78
Replace “`<map name`>” with the name of any mission map. You see a list of mission maps if you select the map type “mission map” when preparing a game.
c725521d6249 Translations: Simplify mission map desc stuff
Wuzzy
parents: 974
diff changeset
    79
c725521d6249 Translations: Simplify mission map desc stuff
Wuzzy
parents: 974
diff changeset
    80
To translate these, add a line of the format `language code=description` (e.g. “en=This is an example.” for English). Since version 0.9.23, you must use the following special character sequences for new lines, commas and underscores:
921
8fab0a7c8164 Translations: Documentation of new desc.txt escapes
Wuzzy
parents: 906
diff changeset
    81
8fab0a7c8164 Translations: Documentation of new desc.txt escapes
Wuzzy
parents: 906
diff changeset
    82
|| *Written text* || *Is replaced by* ||
8fab0a7c8164 Translations: Documentation of new desc.txt escapes
Wuzzy
parents: 906
diff changeset
    83
|| `_n` || New line ||
8fab0a7c8164 Translations: Documentation of new desc.txt escapes
Wuzzy
parents: 906
diff changeset
    84
|| `_c` || Comma ||
8fab0a7c8164 Translations: Documentation of new desc.txt escapes
Wuzzy
parents: 906
diff changeset
    85
|| `__` || Underscore ||
883
54d163c108c1 Translations: mention mission map files
Wuzzy
parents: 798
diff changeset
    86
923
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    87
=== Metadata ===
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    88
The following files are not used by Hedgewars itself, but they contain translatable metadata about Hedgewars:
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    89
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    90
 * `/share/hedgewars/Data/misc/hedgewars.desktop`—[https://wiki.freedesktop.org/www/Specifications/desktop-entry-spec/ Desktop Entry] file for the Hedgewars application
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    91
 * `/share/hedgewars/Data/misc/hwengine.desktop.in`—Desktop Entry file for the Hedgewars engine for playing savegames and demos
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    92
 * `/share/hedgewars/Data/misc/hwengine.desktop`—*Do not translate*! This file will be automatically generated from `hwengine.desktop.in` when building Hedgewars
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    93
 * `/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml`—Description of Hedgewars file types
afa2ae557fb3 Translations: Restructure translation files list
Wuzzy
parents: 922
diff changeset
    94
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
    95
== Updating an existing translation ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    96
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    97
That is relatively easy. Just edit the existing file. You can edit every file with your favorite editor and the `.ts` file with Qt Linguist.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
    98
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
    99
The `en.lua` file doesn’t exist. The strings are hard coded in the code.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   100
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
   101
== Creating a new translation ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   102
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   103
That is easy, too. Make a copy of the English file and rename it to use the initials of your language.
368
2982cf17f347 Edited wiki page Translations through web user interface. Mention stub.lua
pntanasis@gmail.com
parents: 367
diff changeset
   104
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   105
The `en.lua` file doesn’t exist. Use `stub.lua` instead as your template.
368
2982cf17f347 Edited wiki page Translations through web user interface. Mention stub.lua
pntanasis@gmail.com
parents: 367
diff changeset
   106
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   107
Here are 3 examples:
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   108
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   109
 * For French copy `en.txt` to `fr.txt`
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   110
 * For Spanish copy `en.txt` to `es.txt`
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   111
 * For Greek copy `en.txt` to `el.txt`
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   112
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
   113
== Testing the translations ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   114
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   115
When finished you have just to start Hedgewars and choose your language from the Game Preferences, Advanced tab.
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   116
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   117
If a translation is missing then the string is going to be displayed in English.
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   118
Note that you should restart the frondend for the language changes to take effect.
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   119
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
   120
== Sharing the translations ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   121
496
24ffc984d617 Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents: 368
diff changeset
   122
In order to share your translations with Hedgewars community there are 3 possible ways:
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   123
905
fc5ec399d9cf Translations: make DLC link clickable
Wuzzy
parents: 884
diff changeset
   124
 # Give them the files and tell them where to place them. Of course this is the less convenient way but it is maybe a good approach to let other players double-check your translations
976
e1ed13c13a4a Translations: Fix ordering of sharing preferrences
Wuzzy
parents: 975
diff changeset
   125
 # Talk with a Hedgewars developer in order to include it in the next Hedgewars release
906
9879d6e10202 Translations: fix syntax
Wuzzy
parents: 905
diff changeset
   126
 # Talk with a Hedgewars developer in order to include it in [https://hedgewars.org/content.html DLC]
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   127
751
d9b0213fc1a3 Translations: Add title, fix header levels
Wuzzy
parents: 670
diff changeset
   128
== Things to have in mind ==
365
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   129
54349158cbff Created wiki page about translations.
pntanasis@gmail.com
parents:
diff changeset
   130
If you are going to make a translation for a next Hedgewars release strings may not be frozen yet and change before the release. Better ask in irc in cases like that.