forked from CmdrStardust/Alite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Localization Guide.txt
169 lines (125 loc) · 6.83 KB
/
Localization Guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Guide to localization
=====================
1. How to translate
-------------------
Preserve the original meaning as far as possible but the meaning of
the translation in that language is more important than the literal
translation.
Avoid rough, violent, offensive sentences and profanity.
Avoid terms referring to gender, religion, politics or disability.
Do not mix the styles, e.g. if the language has formal / informal
addressing form, as well, choose one of them but not the both.
2. What to translate
--------------------
Basically, you have to translate the values of the strings and
string arrays in file "res/values/strings.xml".
Note that you have to keep the original tag names.
Tag name refers to the place of appearance of the expression but in some cases
further explanation should be needed. Do not hesitate finding the reference of
the text in the source code or contacting to the developers.
3. Structure of language packs
------------------------------
Form of language pack file name has to be
<language>_<country>_<any name you choose>.zip
where language is an ISO 639 alpha-2 or alpha-3 language code,
country is an ISO 3166 alpha-2 country code.
Ideally it contains an 'assets' folder with all files of it
but one or more file may be missed, see also next chapter.
See text of audios in file 'values\strings.xml' where tag names
start with the following prefixes for each audio group in 'sound' folder:
- computer com_
- mission mis_01 and mis_<sub-folder (1-5)>_<file name without mp3 extension>
- tutorial tut_<sub-folder (1-7)>_<file name without mp3 extension>
intro/alite_intro.vtt file is the intro subtitle file.
Beside 'assets' and 'intro' folders it has to contain the translation of texts
in file 'values\strings.xml'.
Format of strings.xml is identical to 'res/values/strings.xml' file
except the followings:
- first line of file has to be <?xml version="1.0" encoding="utf-8"?>
- you have to define the appropriate locale-dependent character
code sets in "char_sets" string array in a slightly different form.
It has the same "start_char_code..end_char_code" format but to define
a character you have to use the form '&#xXXXX;' rather than '\\uXXXX'
since the language packs are not resource files but plain xml files.
See the following example to defining char sets in
strings.xml resource strings.xml of language packs
.................... .............................
<string-array name="char_sets"> <string-array name="char_sets">
<item>\u0020..\u007e</item> <item> ..~</item>
<item>\u00a0..\u00ff</item> <item> ..ÿ</item>
<item>\u0100..\u017f</item> <item>Ā..ſ</item>
</string-array> </string-array>
A degree sign (°) will be displayed in place of an undefined char.
4. Planet names
---------------
Planet names are generated from syllables with a generation algorithm.
32 syllables are listed in "planet_name_syllable" string array in strings.xml
"." represents a non-printable character.
You can omit it from strings.xml of language pack if no changes are needed.
5. Planet descriptions
----------------------
Planet descriptions are defined in array planet_description prefixed by its template id.
Descriptions are generated randomly for each planet but a planet always has the same
description.
If planet description with the required id is not defined in array planet_description
message is printed out to log file and English description will be used.
There are two special references:
* %PLANET_NAME% Returns the capitalized name of the current planet
to which the description is being generated.
* %RANDOM_NAME% Returns a capitalized random name based on the
same algorithm as the system name generation.
6. Texts of plugins
-------------------
You have always two choices for each string type items: use as a regular string
or think about it as a string that can be localized. In the 2nd case you have
to define a key - value pair in Config/strings.xml file where the key must match
to the value of the item.
7. Localization of plugins
--------------------------
Language pack file can contain a 'plugins' folder. In this folder can be
the localization of one or more plugins. Each of them has to be in a
separate folder with name of the unique name of the plugin. Unique name is
the value of the identifier field in its manifest file. Localized strings
and arrays have to be in the Config/strings.xml file. Its structure is
described in the section 3.
8. Using java script
--------------------
You can define java script functions in section "js".
It can be used in strings and items of planet_description in strings.xml.
Calling of java script function must be between <js> and </js> marks.
Example for definition:
function planetian(s) {
return (/[aeiou]/.test(s.charAt(s.length-1)) ? s.substring(0, s.length-1) : s) + "ian";
}
Example for usage:
<js>planetian("%PLANET_NAME%")</js>
This returns the current planet name extended with 'ian' suffix,
if the last char of the planet name is none of the listed vowels (aeiou) or
the current planet name without its last char and 'ian' suffix.
E.g: Lave -> Lavian, Usanat -> Usanatian
9. Control, correction, clarification, completeness
---------------------------------------------------
Even the best is to translate all texts and text audios better to dispatch
a not fully translated language pack file sooner than a perfect one later.
If any text or audio item is missing the default one will be used,
so it does not occur any error and an imperfect language pack is still
better than nothing. You can improve it continuously any time.
10. Contact
-----------
Always provide your name and email address to receive the comments or new
items to translate. It would be the best if you drop an email to the Alite
mail address (currently alite.crash.report@gmail.com) we can contact if
additional translation is needed due to the program development.
In case of typos, required correction, etc. the players can easily contact
with you if you put your name and mail address to the about screen after
the game testers section in form of
[3]<... language translation or translator(s)>
[5]<Put your name here>
[7]<Put your email address here>
11. Sharing the language pack
-----------------------------
Program list all the files uploaded to the folder 'locales' of Alite's
Google Drive on URL https://drive.google.com/drive/folders/1Zrb9svph7iANvhjhgaQuOpjPRBJjeRvm
if you choose Options > Extensions, languages.
For uploading use the script from here:
https://script.google.com/macros/s/AKfycbwlUAPdycOwh8WZMFu3Q6GLaAy90z3hMoDEUIec/exec