author | Wuzzy |
Thu, 14 Nov 2019 16:02:49 +0000 | |
changeset 2103 | 612f6f103787 |
parent 2050 | 840125d4a254 |
child 2197 | 4b9568a3b6d7 |
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. |
1872 | 10 |
# Qt Linguist (not strictly required but strongly recommended). To download Qt Linguist, you have to download the Qt SDK. |
365 | 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 |
||
1296 | 28 |
The *D* way is to download the desired files from [https://hg.hedgewars.org/hedgewars/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 |
|
1083 | 38 |
For example, in an Arch Linux box the path is `/usr/share/hedgewars/Data/Locale`. |
2049 | 39 |
For Windows 8, the path is `C:\Program Files (x86)\Hedgewars <version>\Data\Locale`. |
365 | 40 |
|
1088 | 41 |
== Language codes == |
42 |
Languages are identified with the [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes ISO 639-1 language code] (e.g. “de” for German). For regional language variants, an [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country code] can be appended with an underscore (e.g. “pt_BR” for Brazilian Portuguese). |
|
43 |
||
751 | 44 |
== Translation files == |
922 | 45 |
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 | 46 |
|
1085 | 47 |
=== Overview === |
1107 | 48 |
These are all files which contain translatable text for Hedgewars. Replace “ZZ” with the actual language code. |
1085 | 49 |
* `/share/hedgewars/Data/Locale/ZZ.txt`—In-game strings |
1614 | 50 |
* `/share/hedgewars/Data/Locale/ZZ.lua`—Scripted stuff (missions and game styles) |
1087 | 51 |
* `/share/hedgewars/Data/Locale/hedgewars_ZZ.ts`—Frontend |
1085 | 52 |
* `/share/hedgewars/Data/Locale/missions_ZZ.txt`—Mission names and descriptions |
53 |
* `/share/hedgewars/Data/Locale/campaigns_ZZ.txt`—Campaign names and descriptions |
|
54 |
* `/share/hedgewars/Data/Locale/tips_ZZ.xml`—Main menu tips |
|
55 |
* `/share/hedgewars/Data/Maps/<map name>/desc.txt`—Mission map descriptions |
|
1107 | 56 |
|
57 |
These files are not part of Hedgewars itself, but are used by other programs and websites to present Hedgewars: |
|
58 |
||
1085 | 59 |
* `/share/hedgewars/Data/misc/hedgewars.desktop`—[https://wiki.freedesktop.org/www/Specifications/desktop-entry-spec/ Desktop Entry] file for Hedgewars |
1086 | 60 |
* `/share/hedgewars/Data/misc/hwengine.desktop`—*Do not translate!* |
1085 | 61 |
* `/share/hedgewars/Data/misc/hwengine.desktop.in`—Desktop Entry file for the engine |
62 |
* `/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml`—File type descriptions |
|
1108 | 63 |
* `/share/hedgewars.appdata.xml`—[https://www.freedesktop.org/software/appstream/docs/chap-Quickstart.html AppData] description |
1085 | 64 |
|
923 | 65 |
=== Engine (in-game stuff) === |
1085 | 66 |
* `/share/hedgewars/Data/Locale/ZZ.txt`—This contains the core in-game strings, such as the mission panel, the messages at the top, ammo names and descriptions (see below) |
67 |
* `/share/hedgewars/Data/Locale/ZZ.lua`—Strings used by Lua scripts, which includes campaigns, missions and game styles (see below) |
|
1024 | 68 |
|
1034 | 69 |
==== `.txt` files ==== |
70 |
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”. |
|
71 |
||
1036 | 72 |
Each line must contain a single translation and follows this format: |
1034 | 73 |
|
74 |
`XX:YY=Translation` |
|
75 |
||
76 |
For example: |
|
77 |
||
78 |
`00:00=Grenade` |
|
79 |
||
80 |
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. |
|
81 |
||
82 |
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 | 83 |
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 | 84 |
|
1589 | 85 |
In the `04` and `05` groups, you can use a couple of special characters: |
86 |
||
1590 | 87 |
* `|`: Line break |
1591 | 88 |
* `:`: Highlight itself and all text before that character in this line. The colon itself will be written. |
89 |
* `::`: Like above, except the two colons will not be written. |
|
1590 | 90 |
* `\:`: Will be replaced with “:” without triggering highlighting (escape sequence) |
91 |
* `\|`: Will be replaced with “|” without triggering a line break (escape sequence) |
|
1034 | 92 |
|
93 |
Don't forget to test these texts in-game to make sure everything looks fine. |
|
94 |
||
95 |
==== `.lua` files ==== |
|
1024 | 96 |
In a `.lua` file you will find many lines like this: |
97 |
||
1587 | 98 |
`-- ["Rubber Band"] = "", -- Construction_Mode` |
1024 | 99 |
|
100 |
Those need to be translated. The part in square brackets is the English original text. |
|
101 |
The part in the quotation marks after the equals sign is supposed to contain the translation. |
|
1081 | 102 |
The initial two dashes and spaces are used for strings which hav not been translated yet. You need to remove them after you've completed the translation. |
103 |
||
104 |
The two dashes at the end don't need translation, it's just the beginning of a comment for you to show you the source of the English text. In this case, it comes from the Construction Mode script. |
|
1024 | 105 |
|
106 |
Example for a translated line (in Italian): |
|
107 |
||
1587 | 108 |
`["Rounds Complete"] = "Round Completati",` |
1024 | 109 |
|
110 |
In case you need to include a quotation mark in your translation, write `\"` instead of `"`. |
|
111 |
||
112 |
Note to programmers: These `.lua` files are actually containing real Lua source code. |
|
923 | 113 |
|
114 |
=== Frontend (main menu) === |
|
1085 | 115 |
* `/share/hedgewars/Data/Locale/hedgewars_ZZ.ts`—Contains most strings of the frontend and you can edit it with Qt Linguist |
116 |
* `/share/hedgewars/Data/Locale/missions_ZZ.txt`—This is the [Missions mission] description strings |
|
117 |
* `/share/hedgewars/Data/Locale/campaigns_ZZ.txt`—This is the campaign description strings |
|
1090 | 118 |
* `/share/hedgewars/Data/Locale/tips_ZZ.xml`—This contains the tips shown in the main menu. This file is *not* in XML format. |
669 | 119 |
|
923 | 120 |
==== Mission map descriptions ==== |
121 |
The map selection shows brief descriptions for mission maps below the preview image. Those can be translated and you find those texts in: |
|
883 | 122 |
|
123 |
* `/share/hedgewars/Data/Maps/<map name>/desc.txt` |
|
124 |
||
1588 | 125 |
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. |
975 | 126 |
|
1143 | 127 |
To translate these, add a line of the format `language code=description` (e.g. “en=This is an example.” for English). You must use the following special character sequences for new lines, commas and underscores: |
921 | 128 |
|
129 |
|| *Written text* || *Is replaced by* || |
|
130 |
|| `_n` || New line || |
|
131 |
|| `_c` || Comma || |
|
132 |
|| `__` || Underscore || |
|
883 | 133 |
|
923 | 134 |
=== Metadata === |
135 |
The following files are not used by Hedgewars itself, but they contain translatable metadata about Hedgewars: |
|
136 |
||
137 |
* `/share/hedgewars/Data/misc/hedgewars.desktop`—[https://wiki.freedesktop.org/www/Specifications/desktop-entry-spec/ Desktop Entry] file for the Hedgewars application |
|
138 |
* `/share/hedgewars/Data/misc/hwengine.desktop.in`—Desktop Entry file for the Hedgewars engine for playing savegames and demos |
|
139 |
* `/share/hedgewars/Data/misc/hwengine.desktop`—*Do not translate*! This file will be automatically generated from `hwengine.desktop.in` when building Hedgewars |
|
140 |
* `/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml`—Description of Hedgewars file types |
|
1106 | 141 |
* `/share/hedgewars.appdata.xml`—[https://www.freedesktop.org/software/appstream/docs/chap-Quickstart.html AppData] description (for the desciption in software distribution services) |
923 | 142 |
|
751 | 143 |
== Updating an existing translation == |
365 | 144 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
145 |
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 | 146 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
147 |
The `en.lua` file doesn’t exist. The strings are hard coded in the code. |
365 | 148 |
|
751 | 149 |
== Creating a new translation == |
365 | 150 |
|
1085 | 151 |
That is easy, too. Make a copy of the English file and rename it to use the language code. For the files in the `misc` directory, you need to add an additional line for your language (if it is missing). |
368
2982cf17f347
Edited wiki page Translations through web user interface. Mention stub.lua
pntanasis@gmail.com
parents:
367
diff
changeset
|
152 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
153 |
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
|
154 |
|
1090 | 155 |
Example for French: |
365 | 156 |
|
1085 | 157 |
* Copy `en.txt` to `fr.txt` |
158 |
* Copy `stub.lua` to `fr.lua` |
|
1090 | 159 |
* Copy `tips_en.xml` to `tips_fr.xml` |
365 | 160 |
|
751 | 161 |
== Testing the translations == |
365 | 162 |
|
1090 | 163 |
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
|
164 |
|
1090 | 165 |
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
|
166 |
Note that you should restart the frondend for the language changes to take effect. |
365 | 167 |
|
751 | 168 |
== Sharing the translations == |
365 | 169 |
|
496
24ffc984d617
Copy editing, add tips_en.xml to list of translation files
almikes@aol.com
parents:
368
diff
changeset
|
170 |
In order to share your translations with Hedgewars community there are 3 possible ways: |
365 | 171 |
|
1050 | 172 |
# Talk with a Hedgewars developer in order to include it in the next Hedgewars release. This is the best possible solution |
2050 | 173 |
# Talk with a Hedgewars developer in order to include it in [https://hedgewars.org/wiki/Downloadable_Content DLC] |
905 | 174 |
# 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 |
1050 | 175 |
|
176 |
== Abbreviations == |
|
177 |
You will find a few abbreviations in the files. here's what they mean: |
|
178 |
||
179 |
=== A Space Adventure === |
|
180 |
* *PAotH*: Planetary Association of the Hedgehogs |
|
181 |
* *Hog Solo and GB*: Hog Solo and Green Bananas |
|
182 |
* *RS1*: Red Strawberries 1 |
|
183 |
* *RS2*: Red Strawberries 2 |
|
365 | 184 |
|
1052 | 185 |
=== General === |
186 |
* *AFK*: Away From Keyboard |
|
187 |
* *fps*: frames per second |
|
188 |
* *s*: second ([https://en.wikipedia.org/wiki/International_System_of_Units SI unit] of time) |
|
189 |
* *min*: minute |
|
190 |
||
751 | 191 |
== Things to have in mind == |
365 | 192 |
|
1084 | 193 |
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 [https://hedgewars.org/chat our chatroom] in cases like that. |
1047 | 194 |
|
1084 | 195 |
Feel free to translate hedgehog and team names into your own language, when it makes sense. Remember that most names are meant to be funny and puns are not uncommon. The game should be enjoyable in all languages. |