author | Wuzzy |
Thu, 28 Sep 2017 22:52:57 +0100 | |
changeset 1048 | 50f29e5934c5 |
parent 1047 | fb4797358321 |
child 1049 | be9fe7c0d667 |
permissions | -rw-r--r-- |
365 | 1 |
#summary This is a guide for new translators. |
2 |
||
751 | 3 |
= Translations = |
4 |
== Introduction == |
|
365 | 5 |
|
6 |
This is a guide for translators. In order to translate Hedgewars into another language you are going to need: |
|
7 |
||
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 | 10 |
# Qt4 Linguist. To download the Qt4 Linguist you have to download the Qt4 SDK. |
11 |
||
751 | 12 |
== Getting the localization files == |
365 | 13 |
|
14 |
To get the Hedgewars localization files there are 4 possible ways. |
|
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 | 20 |
|
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. |
|
22 |
||
23 |
The *B* way is a lot like the *A* way but more limited. |
|
24 |
||
25 |
The *C* is probably the fastest way and the more convenient for the translator. |
|
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. |
|
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 | 29 |
|
30 |
Above I am going to discuss the *C* way (Find the localization files in your current Hedgewars installation). |
|
31 |
||
751 | 32 |
=== Finding the localization files === |
365 | 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 | 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 | 40 |
|
751 | 41 |
== Translation files == |
922 | 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 | 43 |
|
923 | 44 |
=== Engine (in-game stuff) === |
1034 | 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 (see below) |
1024 | 46 |
* `/share/hedgewars/Data/Locale/stub.lua`—Strings used by Lua scripts, which includes campaigns, missions and game styles (see below) |
47 |
||
1034 | 48 |
==== `.txt` files ==== |
49 |
A `.txt` file is organized in lines and string identifiers. Each string is identified with two numbers like `01:05`. The first number is called the “group”. |
|
50 |
||
1036 | 51 |
Each line must contain a single translation and follows this format: |
1034 | 52 |
|
53 |
`XX:YY=Translation` |
|
54 |
||
55 |
For example: |
|
56 |
||
57 |
`00:00=Grenade` |
|
58 |
||
59 |
See `en.txt` for the English original texts. Note that some of the numbers may be missing in your file, so you need to add them on your own. |
|
60 |
||
61 |
The group `02` is special because texts can be repeated here. These texts are used for event messages like the death of a hedgehog (`02:00`). Hedgewars will randomly use any of these messages in the same group. Each language can have its own set of messages for this. Translations can be rather flexible here. |
|
1036 | 62 |
In `02`, you don't need to translate every English message, but try to do your best. It is OK to omit messages if a direct translation wouldn't make sense (e.g. for weird English idioms). You can also invent your messages which are more appropriate for your language. If you're in a hurry, you can just add single a single message for each of the `02` groups (`02:00`, `02:01`, `02:02`, etc.), but don't forget to finish it later. |
1034 | 63 |
|
64 |
In the `04` and `05` groups, you can use two special characters: |
|
65 |
The `|` character is used as a line break. |
|
66 |
Also, for each line, all text written before a colon (`:`) including the colon itself will be highlighted. |
|
67 |
||
68 |
Don't forget to test these texts in-game to make sure everything looks fine. |
|
69 |
||
70 |
==== `.lua` files ==== |
|
1024 | 71 |
In a `.lua` file you will find many lines like this: |
72 |
||
73 |
```["Rubber Band"] = "", -- Construction_Mode``` |
|
74 |
||
75 |
Those need to be translated. The part in square brackets is the English original text. |
|
76 |
The part in the quotation marks after the equals sign is supposed to contain the translation. |
|
77 |
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. |
|
78 |
||
79 |
Example for a translated line (in Italian): |
|
80 |
||
81 |
```["Rounds Complete"] = "Round Completati",``` |
|
82 |
||
83 |
Lines which look different than the lines described above have a special meaning and must not be changed. |
|
84 |
In case you need to include a quotation mark in your translation, write `\"` instead of `"`. |
|
85 |
Lines beginning with two dashes can be ignored. |
|
86 |
||
87 |
Note to programmers: These `.lua` files are actually containing real Lua source code. |
|
923 | 88 |
|
89 |
=== Frontend (main menu) === |
|
90 |
* `/share/hedgewars/Data/Locale/hedgewars_en.ts`—Contains most strings of the frontend and you can edit it with Qt Linguist |
|
670 | 91 |
* `/share/hedgewars/Data/Locale/missions_en.txt`—This is the [Missions mission] description strings |
92 |
* `/share/hedgewars/Data/Locale/campaigns_en.txt`—This is the campaign description strings |
|
93 |
* `/share/hedgewars/Data/Locale/tips_en.xml`—This contains the tips shown in the main menu. This file is *not* in XML format! |
|
669 | 94 |
|
923 | 95 |
==== Mission map descriptions ==== |
96 |
The map selection shows brief descriptions for mission maps below the preview image. Those can be translated and you find those texts in: |
|
883 | 97 |
|
98 |
* `/share/hedgewars/Data/Maps/<map name>/desc.txt` |
|
99 |
||
975 | 100 |
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. |
101 |
||
102 |
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 | 103 |
|
104 |
|| *Written text* || *Is replaced by* || |
|
105 |
|| `_n` || New line || |
|
106 |
|| `_c` || Comma || |
|
107 |
|| `__` || Underscore || |
|
883 | 108 |
|
923 | 109 |
=== Metadata === |
110 |
The following files are not used by Hedgewars itself, but they contain translatable metadata about Hedgewars: |
|
111 |
||
112 |
* `/share/hedgewars/Data/misc/hedgewars.desktop`—[https://wiki.freedesktop.org/www/Specifications/desktop-entry-spec/ Desktop Entry] file for the Hedgewars application |
|
113 |
* `/share/hedgewars/Data/misc/hwengine.desktop.in`—Desktop Entry file for the Hedgewars engine for playing savegames and demos |
|
114 |
* `/share/hedgewars/Data/misc/hwengine.desktop`—*Do not translate*! This file will be automatically generated from `hwengine.desktop.in` when building Hedgewars |
|
115 |
* `/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml`—Description of Hedgewars file types |
|
116 |
||
751 | 117 |
== Updating an existing translation == |
365 | 118 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
119 |
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 | 120 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
121 |
The `en.lua` file doesn’t exist. The strings are hard coded in the code. |
365 | 122 |
|
751 | 123 |
== Creating a new translation == |
365 | 124 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
125 |
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
|
126 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
127 |
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
|
128 |
|
365 | 129 |
Here are 3 examples: |
130 |
||
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
131 |
* 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
|
132 |
* 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
|
133 |
* For Greek copy `en.txt` to `el.txt` |
365 | 134 |
|
751 | 135 |
== Testing the translations == |
365 | 136 |
|
137 |
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
|
138 |
|
365 | 139 |
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
|
140 |
Note that you should restart the frondend for the language changes to take effect. |
365 | 141 |
|
751 | 142 |
== Sharing the translations == |
365 | 143 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
144 |
In order to share your translations with Hedgewars community there are 3 possible ways: |
365 | 145 |
|
905 | 146 |
# 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 | 147 |
# Talk with a Hedgewars developer in order to include it in the next Hedgewars release |
906 | 148 |
# Talk with a Hedgewars developer in order to include it in [https://hedgewars.org/content.html DLC] |
365 | 149 |
|
751 | 150 |
== Things to have in mind == |
365 | 151 |
|
1047 | 152 |
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. |
153 |
||
154 |
== Abbreviations == |
|
155 |
The following abbreviations are used in Hedgewars: |
|
156 |
||
1048 | 157 |
* **PAotH**: Planetary Association of the Hedgehogs |
158 |
* **Hog Solo and GB**: Hog Solo and Green Bananas |
|
159 |
* **RS1**: Red Strawberries 1 |
|
160 |
* **RS2**: Red Strawberries 2 |