LocalizationSystem

Version 4 (kervala, 04/21/2012 11:42 am)

1 2 kervala
h1. *Localization system in Ryzom*
2 1 kervala
3 4 kervala
> TODO: improve formatting, original document is https://docs.google.com/Doc?docid=0ATbRb4Xh6srtZGhrbjluOHRfMThmemNjcDZkZw&authkey=CKTG4-QM
4 4 kervala
5 2 kervala
h2. Overview
6 1 kervala
7 2 kervala
There are mainly two distinct parts in localization for Ryzom. The first part (and the easiest) concerns the static localization on the client side (eg interface names, error messages). The second part is for dynamically generated text from servers.
8 1 kervala
9 1 kervala
10 3 kervala
!dhkn9n8t_19f5n89nf3_b.gif!
11 1 kervala
12 2 kervala
As you can see in the diagram, there are four kind of file that makes the localization system to work. Each of this file must come in each localized language. In bold, you can see that each file contains the language code in its name.
13 1 kervala
14 2 kervala
File formats are discussed below.
15 1 kervala
16 2 kervala
h2. Language code
17 1 kervala
18 2 kervala
Language in Ryzom are identified by there language code as defined in "ISO 639-1":http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes plus a country code defined in "ISO 3166":http://en.wikipedia.org/wiki/ISO_3166 *if necessary*.
19 1 kervala
20 1 kervala
21 1 kervala
22 1 kervala
23 1 kervala
24 2 kervala
ISO 639-1 is a two character language code (e.g. ‘en’, ‘fr’). This is enough for most of the language we want to support.
25 1 kervala
26 2 kervala
But there is some exception, like Chinese written language.
27 1 kervala
28 2 kervala
Chinese can be written in two forms: traditional or simplified. Nonetheless, there is only one language code for Chinese: ‘hz’.
29 1 kervala
30 2 kervala
So, we must append a country code to indicate witch form of written Chinese we discuss. The language code for simplified Chinese become ‘hz-CN’ (i.e. Chinese language, Chinese country), and for traditional Chinese, it is ‘hz’ only because all other Chinese speaking country (Taiwan, Hong Kong, ? ) use the traditional Chinese.
31 1 kervala
32 2 kervala
h2. Identifier definition
33 1 kervala
34 2 kervala
Translated strings are associated to identifier. Identifiers are textual string that must follow the C identifier constraint with a little difference.
35 1 kervala
36 2 kervala
A C identifier must consist only of the following caracteres: ‘A-Z’, ‘a-z’, ‘0-9’, ‘@‘ and ‘_’. Real C identifier can’t start with a number, string identifier can.
37 1 kervala
38 1 kervala
39 1 kervala
40 1 kervala
41 2 kervala
Some good identifier:
42 1 kervala
43 1 kervala
44 1 kervala
45 1 kervala
46 2 kervala
This_is_a_good_identifier
47 1 kervala
48 2 kervala
ThisIsAGoodIdentifier
49 1 kervala
50 2 kervala
_This@is@notherGoodId
51 1 kervala
52 2 kervala
1234_is_a_goodId
53 1 kervala
54 2 kervala
This_Is_Good_1234
55 1 kervala
56 1 kervala
57 1 kervala
58 1 kervala
59 2 kervala
Some bad identifier:
60 1 kervala
61 1 kervala
62 1 kervala
63 1 kervala
64 2 kervala
This is a *bad* identifier
65 1 kervala
66 2 kervala
é#()|{[_IdBAD
67 1 kervala
68 2 kervala
h2. File formats
69 1 kervala
70 2 kervala
There are three different translation file formats. But only two need to be learned ;-)
71 1 kervala
72 2 kervala
h3. Format 1
73 1 kervala
74 2 kervala
This format is used for client side static text and for server side clause text.
75 1 kervala
76 2 kervala
The file is a list of identifiant to string association (also called value string). Identifiant must conform to C identifier constraint and value string is delimited by ‘[‘ and ‘]’.
77 1 kervala
78 2 kervala
Text layout is free; you can jump line and indent as you want.
79 1 kervala
80 1 kervala
81 1 kervala
82 1 kervala
83 2 kervala
identifiant1 [textual value]
84 1 kervala
85 2 kervala
identifiant2 [other textual value]
86 1 kervala
87 1 kervala
88 1 kervala
89 1 kervala
90 2 kervala
This file can contain C style comments.
91 1 kervala
92 1 kervala
93 1 kervala
94 1 kervala
95 2 kervala
*// This is a single line comment. Continue until end of line*
96 1 kervala
97 2 kervala
identifiant1 [textual value]
98 1 kervala
99 2 kervala
*/* This is *
100 1 kervala
101 2 kervala
* a multiline *
102 1 kervala
103 2 kervala
* comment */*
104 1 kervala
105 2 kervala
identifiant2 */* multiline comment here ! */* [other textual value]
106 1 kervala
107 1 kervala
108 1 kervala
109 1 kervala
110 2 kervala
Textual value can be formated for readability. New line and tab are removed in the final string value.
111 1 kervala
112 1 kervala
113 1 kervala
114 1 kervala
115 2 kervala
identifiant1 [textual
116 1 kervala
117 2 kervala
value
118 1 kervala
119 2 kervala
with
120 1 kervala
121 2 kervala
new line
122 1 kervala
123 2 kervala
and tab formating only for readability]
124 1 kervala
125 2 kervala
identifiant2 [other textual value]
126 1 kervala
127 1 kervala
128 1 kervala
129 1 kervala
130 2 kervala
If you need to specify new lines or tabulations in the value string, you must use C style escape sequence ‘\t’ for tab and ‘\n’ for new line. To write a ‘\’ in the string value, double the backslash: ‘\\’. To write a ‘]’ int the string, escape it with a backslash: ‘\]’.
131 1 kervala
132 1 kervala
133 1 kervala
134 1 kervala
135 2 kervala
identifiant1 [tabulation: *\t*This text is tabbed]
136 1 kervala
137 2 kervala
identifiant2 [New line *\n*Text on next line]
138 1 kervala
139 2 kervala
identifiant3 [Backslash: *\\*]
140 1 kervala
141 2 kervala
identifiant4 [a closing square bracket: *\]* ]
142 1 kervala
143 1 kervala
144 1 kervala
145 1 kervala
146 2 kervala
You can split the original file in multiple small file, more easy to maintain and work with.
147 1 kervala
148 2 kervala
This feature is achieved by using a C like preprocessor command “#include”.
149 1 kervala
150 1 kervala
151 1 kervala
152 1 kervala
153 2 kervala
#include "path/filename.txt"
154 1 kervala
155 1 kervala
156 1 kervala
157 1 kervala
158 2 kervala
You can have any number of include command. Included files can also contains include commands.
159 1 kervala
160 2 kervala
The path can be either an absolute path or a path relative to the location of the master file.
161 1 kervala
162 2 kervala
h3. Format 2
163 1 kervala
164 2 kervala
This format is used for phrases translation files.
165 1 kervala
166 2 kervala
This format is a pretty complex grammar that will be described in a near LALR syntax:
167 1 kervala
168 1 kervala
169 1 kervala
170 1 kervala
171 2 kervala
*identifiant* : [A-Za-z0-9_@]+
172 1 kervala
173 1 kervala
174 1 kervala
175 1 kervala
176 2 kervala
*phrase* : *identifiant* ‘(‘ *parameterList* ‘)’
177 1 kervala
178 2 kervala
‘{‘
179 1 kervala
180 2 kervala
*clauseList*
181 1 kervala
182 2 kervala
‘}’
183 1 kervala
184 1 kervala
185 1 kervala
186 1 kervala
187 2 kervala
*parameterList* : *parameterList* ‘,’ *parameterDesc*
188 1 kervala
189 2 kervala
| *parameterDesc*
190 1 kervala
191 1 kervala
192 1 kervala
193 1 kervala
194 2 kervala
*parameterDesc* : *parameterType* *parameterName*
195 1 kervala
196 1 kervala
197 1 kervala
198 1 kervala
199 2 kervala
*parameterName* : *identifiant*
200 1 kervala
201 1 kervala
202 1 kervala
203 1 kervala
204 2 kervala
*parameterType* : ‘item’
205 1 kervala
206 2 kervala
| ‘place’
207 1 kervala
208 2 kervala
| ‘creature’
209 1 kervala
210 2 kervala
| ‘skill’
211 1 kervala
212 2 kervala
| ‘role’
213 1 kervala
214 2 kervala
| ‘ecosystem’
215 1 kervala
216 2 kervala
| ‘race’
217 1 kervala
218 2 kervala
| ‘brick’
219 1 kervala
220 2 kervala
| ‘tribe’
221 1 kervala
222 2 kervala
| ‘guild’
223 1 kervala
224 2 kervala
| ‘player’
225 1 kervala
226 2 kervala
| ‘int’
227 1 kervala
228 2 kervala
| ‘bot’
229 1 kervala
230 2 kervala
| ‘time’
231 1 kervala
232 2 kervala
| ‘money’
233 1 kervala
234 2 kervala
| ‘compass’
235 1 kervala
236 2 kervala
| ‘dyn_string_id’
237 1 kervala
238 2 kervala
| ‘string_id’
239 1 kervala
240 2 kervala
| ‘self’
241 1 kervala
242 2 kervala
| ‘creature_model’
243 1 kervala
244 2 kervala
| ‘entity’
245 1 kervala
246 2 kervala
| ‘bot_name’
247 1 kervala
248 2 kervala
| ‘bodypart’
249 1 kervala
250 2 kervala
| ‘score’
251 1 kervala
252 2 kervala
| ‘sphrase’
253 1 kervala
254 2 kervala
| ‘characteristic’
255 1 kervala
256 2 kervala
| ‘damage_type’
257 1 kervala
258 2 kervala
| ‘literal’
259 1 kervala
260 1 kervala
261 1 kervala
262 1 kervala
263 2 kervala
*clauseList* : *clauseList* *clause*
264 1 kervala
265 2 kervala
| *clause*
266 1 kervala
267 1 kervala
268 1 kervala
269 2 kervala
270 2 kervala
*clause* : *conditionList* *identifiant* *textValue*
271 2 kervala
272 2 kervala
| *identifiant* *textValue*
273 2 kervala
274 2 kervala
| *conditionList* *identifiant*
275 2 kervala
276 2 kervala
| *identifiant*
277 2 kervala
278 2 kervala
| *textValue*
279 2 kervala
280 2 kervala
281 2 kervala
282 2 kervala
283 2 kervala
*conditionList* : *conditionList* *condition*
284 2 kervala
285 2 kervala
| *condition*
286 2 kervala
287 2 kervala
288 2 kervala
289 2 kervala
290 2 kervala
*condition* : ‘(‘ *testList* ‘)’
291 2 kervala
292 2 kervala
293 2 kervala
294 2 kervala
295 2 kervala
*testList* : *testList* ‘&’ *test*
296 2 kervala
297 2 kervala
| *test*
298 2 kervala
299 2 kervala
300 2 kervala
301 2 kervala
302 2 kervala
*test* : *operand1* *operator* *reference*
303 2 kervala
304 2 kervala
305 2 kervala
306 2 kervala
307 2 kervala
*operand1* : *parameterName*
308 2 kervala
309 2 kervala
| *parameterName*’.’*propertyName*
310 2 kervala
311 2 kervala
312 2 kervala
313 2 kervala
314 2 kervala
*propertyName* : *identifiant*
315 2 kervala
316 2 kervala
317 2 kervala
318 2 kervala
319 2 kervala
*operator* : ‘=’
320 2 kervala
321 2 kervala
| ‘!=’
322 2 kervala
323 2 kervala
| ‘<’
324 2 kervala
325 2 kervala
| ‘<=’
326 2 kervala
327 2 kervala
| ‘>’
328 2 kervala
329 2 kervala
| ‘<=’
330 2 kervala
331 2 kervala
332 2 kervala
333 2 kervala
334 2 kervala
*reference* : *identifiant*
335 2 kervala
336 2 kervala
337 2 kervala
338 2 kervala
339 2 kervala
*textValue* : ‘[‘ .* ‘]’
340 2 kervala
341 2 kervala
342 2 kervala
343 2 kervala
344 2 kervala
345 2 kervala
346 2 kervala
As in format 1, you can include C style comment in the text and indent freely and use the include command.
347 2 kervala
348 2 kervala
h3. Format 3: Spreadsheet unicode export
349 2 kervala
350 2 kervala
351 2 kervala
 This format is the result of a Unicode text export from Spreadsheet.
352 2 kervala
Encoding should be unicode 16 bits. Columns are tab separated and rows are new line separated.
353 2 kervala
354 2 kervala
You should not write this file by hand, but only edit it with Spreadsheet.
355 2 kervala
356 2 kervala
The first row must contain the columns names.
357 2 kervala
358 2 kervala
359 2 kervala
360 2 kervala
361 2 kervala
*Info columns*
362 2 kervala
363 2 kervala
If a column name start with a ‘*’, then all the column is ignored.
364 2 kervala
365 2 kervala
This is useful to add information column that can help translation.
366 2 kervala
367 2 kervala
368 2 kervala
369 2 kervala
370 2 kervala
*Delete character*
371 2 kervala
372 2 kervala
It is possible to insert a ‘delete’ command in the field: ‘\d’. This is useful for article translation.
373 2 kervala
374 2 kervala
Example: you have a string with the following replacement (in French):
375 2 kervala
376 2 kervala
377 2 kervala
378 2 kervala
379 2 kervala
"Rapporte moi $item.da$ $item.name$"
380 2 kervala
381 2 kervala
382 2 kervala
383 2 kervala
384 2 kervala
And the item words file contains the following:
385 2 kervala
386 2 kervala
387 2 kervala
388 2 kervala
389 2 kervala
item name da
390 2 kervala
391 2 kervala
marteau marteau le
392 2 kervala
393 2 kervala
echelle échelle l’
394 2 kervala
395 2 kervala
396 2 kervala
397 2 kervala
398 2 kervala
If the item is ‘marteau’, no problem, the replacement gives:
399 2 kervala
400 2 kervala
401 2 kervala
402 2 kervala
403 2 kervala
"Rapporte moi *le* *marteau*"
404 2 kervala
405 2 kervala
406 2 kervala
407 2 kervala
408 2 kervala
But for the ‘echelle’, there is a supplementary space in the result:
409 2 kervala
410 2 kervala
411 2 kervala
412 2 kervala
413 2 kervala
"Rapporte moi *l’* *échelle*"
414 2 kervala
415 2 kervala
416 2 kervala
417 2 kervala
To remove this supplementary space, you can add a ‘delete’ marker in the article definition:
418 2 kervala
419 2 kervala
420 2 kervala
421 2 kervala
422 2 kervala
item name da
423 2 kervala
424 2 kervala
marteau marteau le
425 2 kervala
426 2 kervala
echelle échelle *l’\d*
427 2 kervala
428 2 kervala
429 2 kervala
430 2 kervala
431 2 kervala
This will give a correct resulting string:
432 2 kervala
433 2 kervala
434 2 kervala
435 2 kervala
436 2 kervala
"Rapporte moi *l’échelle*"
437 2 kervala
438 2 kervala
439 2 kervala
440 2 kervala
h2. Working with translation files, translator point of view
441 2 kervala
442 2 kervala
h3. Client side “*.uxt” files
443 2 kervala
444 2 kervala
This file contains all static text available directly to the client. The text must conforms to format 1 described above.
445 2 kervala
446 2 kervala
There is an additional constraint: you MUST provide as a first entry the language name, as spelled in the language (eg ‘English’ for English, ‘Français’ for French).
447 2 kervala
448 2 kervala
For example, the file en.uxt must begin with:
449 2 kervala
450 2 kervala
451 2 kervala
452 2 kervala
453 2 kervala
languageName [English]
454 2 kervala
455 2 kervala
h3. Server side files
456 2 kervala
457 2 kervala
Server side translation is a bit more complex.
458 2 kervala
459 2 kervala
We will learn how to write server side translation in four steps (guess what: from simple to complex problem!).
460 2 kervala
461 2 kervala
462 2 kervala
463 2 kervala
464 2 kervala
*Step 1: A simple string:*
465 2 kervala
466 2 kervala
For this, you only need the phrase file.
467 2 kervala
468 2 kervala
Let’s say we want a string saying “hello world!” identified by HelloWorld.
469 2 kervala
470 2 kervala
Create a phrase entry in phrase_en.txt:
471 2 kervala
472 2 kervala
473 2 kervala
474 2 kervala
475 2 kervala
HelloWorld ()
476 2 kervala
477 2 kervala
{
478 2 kervala
479 2 kervala
[Hello world!]
480 2 kervala
481 2 kervala
}
482 2 kervala
483 2 kervala
484 2 kervala
485 2 kervala
486 2 kervala
That’s it! No more.
487 2 kervala
488 2 kervala
Of course, you must also provide the same phrase in all the supported language, for example, in phrase_fr.txt:
489 2 kervala
490 2 kervala
491 2 kervala
492 2 kervala
493 2 kervala
HelloWorld ()
494 2 kervala
495 2 kervala
{
496 2 kervala
497 2 kervala
[Bonjour le monde!]
498 2 kervala
499 2 kervala
}
500 2 kervala
501 2 kervala
502 2 kervala
503 2 kervala
504 2 kervala
Note that only the text value has changed. The phrase identifier MUST remain the same in all the translations files.
505 2 kervala
506 2 kervala
507 2 kervala
508 2 kervala
509 2 kervala
*Step 2: Indirection to clause_<lang>.txt*
510 2 kervala
511 2 kervala
In step 4, we will see that the phrase file will become very complex. Thus, this file is not well fitted for giving it to a professional translator with no skill in complex grammar file. More, the complexity of the file can hide the work to do for translation.
512 2 kervala
513 2 kervala
So, you can split phrase grammar in phrase file and text value in clause file.
514 2 kervala
515 2 kervala
516 2 kervala
517 2 kervala
518 2 kervala
To do this, you must assign a unique identifier to each text value.
519 2 kervala
520 2 kervala
Let’s rebuild the previous example with indirection.
521 2 kervala
522 2 kervala
In phrase_en.txt, create the phrase entry like this:
523 2 kervala
524 2 kervala
525 2 kervala
526 2 kervala
527 2 kervala
HelloWorld ()
528 2 kervala
529 2 kervala
{
530 2 kervala
531 2 kervala
Hello
532 2 kervala
533 2 kervala
}
534 2 kervala
535 2 kervala
536 2 kervala
537 2 kervala
538 2 kervala
We just have put an identifier in the phrase block. This means that the phrase refers to a string identified as “Hello” in the clause file.
539 2 kervala
540 2 kervala
Now, we can create the text value in clause_en.txt:
541 2 kervala
542 2 kervala
543 2 kervala
544 2 kervala
545 2 kervala
Hello [Hello world!]
546 2 kervala
547 2 kervala
548 2 kervala
549 2 kervala
550 2 kervala
As in the first step, you must do this task for each language.
551 2 kervala
552 2 kervala
553 2 kervala
554 2 kervala
555 2 kervala
TIPS: in order to facilitate translation work, it is possible to specify the string identifier AND the string value. This can be helpful for automatic building of translation file from the original one.
556 2 kervala
557 2 kervala
Example:
558 2 kervala
559 2 kervala
560 2 kervala
561 2 kervala
562 2 kervala
HelloWorld ()
563 2 kervala
564 2 kervala
{
565 2 kervala
566 2 kervala
Hello [Bonjour le monde!]
567 2 kervala
568 2 kervala
}
569 2 kervala
570 2 kervala
571 2 kervala
572 2 kervala
573 2 kervala
In such case, the translation system always look first in the clause file and fallback to string value in the phrase file only if the string is not found in the clause file.
574 2 kervala
575 2 kervala
The other advantage is that the person who wrote the phrase file can give a simplistic version of the string that a professional translator will improve.
576 2 kervala
577 2 kervala
578 2 kervala
579 2 kervala
580 2 kervala
*Step 3: Using parameters - basics *
581 2 kervala
582 2 kervala
Here we are entering in the complex stuff!
583 2 kervala
584 2 kervala
Each phrase can receive a list of parameter.
585 2 kervala
586 2 kervala
Those parameters can be of different types:
587 2 kervala
588 2 kervala
* item,
589 2 kervala
* place,
590 2 kervala
* creature,
591 2 kervala
* skill,
592 2 kervala
* ecosystem,
593 2 kervala
* race,
594 2 kervala
* brick,
595 2 kervala
* tribe,
596 2 kervala
* guild,
597 2 kervala
* player,
598 2 kervala
* int,
599 2 kervala
* bot,
600 2 kervala
* time,
601 2 kervala
* money,
602 2 kervala
* compass,
603 2 kervala
* dyn_string_id,
604 2 kervala
* string_id,
605 2 kervala
* creature_model,
606 2 kervala
* entity,
607 2 kervala
608 2 kervala
* body_part,
609 2 kervala
* score,
610 2 kervala
* sphrase,
611 2 kervala
* characteristic,
612 2 kervala
613 2 kervala
* damage_type,
614 2 kervala
* bot_name,
615 2 kervala
* literal.
616 2 kervala
617 2 kervala
618 2 kervala
619 2 kervala
620 2 kervala
Each parameter is given a name (or identifier) when declared. We will call it paramName.
621 2 kervala
622 2 kervala
623 2 kervala
624 2 kervala
625 2 kervala
Each type of parameter CAN be associated with a ‘word’ file. This file is an excel sheet (in unicode text export form) that contain translations for the parameter: its name, undefined or defined article (e.g. ‘a’, ‘the’, etc), plural name and article and any useful property or grammar element needed for translation.
626 2 kervala
627 2 kervala
The first column is very important because it associate a row of data with a particular parameter value.
628 2 kervala
629 2 kervala
630 2 kervala
631 2 kervala
632 2 kervala
Let’s begin with an example: we want to build a dynamic phrase with a variable creature race name.
633 2 kervala
634 2 kervala
First, we must build an excel sheet to define the words for creature type. This will be saved as race_words_<lang>.txt in unicode text export from excel. As always, you must provide a version of this file for each language.
635 2 kervala
636 2 kervala
NB: The first column MUST always be the association field and you should have a ‘name’ column as it’s the default replacement for parameter. Any other column is optional and can vary from language to language to accommodate any specific grammar constraint.
637 2 kervala
638 2 kervala
This is an example race_words_en.txt:
639 2 kervala
640 2 kervala
641 2 kervala
642 2 kervala
643 2 kervala
race name ia da p pia pda
644 2 kervala
645 2 kervala
kitifly Kitifly a the Kitiflys the
646 2 kervala
647 2 kervala
varynx Varynx a the Varynx the
648 2 kervala
649 2 kervala
etc…
650 2 kervala
651 2 kervala
652 2 kervala
653 2 kervala
654 2 kervala
As stated in the note above, the first column give the race identifier as defined in the game dev sheets. The second column is the ‘highly advisable’ column for the name of the race. The ‘p’ column if the plural name. ‘ia’, ‘da’ stand for indefined article and defined article.
655 2 kervala
656 2 kervala
657 2 kervala
658 2 kervala
659 2 kervala
Next, we must create a phrase with a creature parameter in phrase_<lang>.txt:
660 2 kervala
661 2 kervala
662 2 kervala
663 2 kervala
664 2 kervala
KILL_A_CREATURE (*race crea*)
665 2 kervala
666 2 kervala
{}
667 2 kervala
668 2 kervala
669 2 kervala
670 2 kervala
671 2 kervala
As you can see, after the phrase identifier KILL_THIS_CREATURE we have the parameter list between the braket. We declare a parameter of type race named crea. Note that you choose freely your parameter name but each parameter must have a unique name (at least for one phrase).
672 2 kervala
673 2 kervala
674 2 kervala
675 2 kervala
676 2 kervala
Now, we can build the string value. To insert parameter into the string, we must specify replacement point by using the ‘$’ sign (eg $crea$) directly into the string value:
677 2 kervala
678 2 kervala
679 2 kervala
680 2 kervala
681 2 kervala
KILL_A_CREATURE (race crea)
682 2 kervala
683 2 kervala
{
684 2 kervala
685 2 kervala
[Would you please kill a *$crea$* for me ?]
686 2 kervala
687 2 kervala
}
688 2 kervala
689 2 kervala
690 2 kervala
691 2 kervala
692 2 kervala
As you can see, it’s not too complex. $crea$ will be replaced with the content of the field from the words file in the ‘name’ column and at the row corresponding to the race identifier.
693 2 kervala
694 2 kervala
695 2 kervala
696 2 kervala
697 2 kervala
▪ It is possible to recall any of the words file columns in the value string. We can for example dynamize the undefined article:
698 2 kervala
699 2 kervala
700 2 kervala
701 2 kervala
702 2 kervala
KILL_A_CREATURE (race crea)
703 2 kervala
704 2 kervala
{
705 2 kervala
706 2 kervala
[Would you please kill *$crea.ia$* *$crea$* for me ?]
707 2 kervala
708 2 kervala
}
709 2 kervala
710 2 kervala
711 2 kervala
712 2 kervala
713 2 kervala
▪ Some parameter type have special replacement rules: int are replaced with their text representation, time are converted to ryzom time readable format, as well as money.
714 2 kervala
715 2 kervala
716 2 kervala
717 2 kervala
718 2 kervala
Last but not least, the identifier and indirection rules see in step 1 and 2 are still valid.
719 2 kervala
720 2 kervala
721 2 kervala
722 2 kervala
723 2 kervala
*Step 4: Using parameters: conditional clause*
724 2 kervala
725 2 kervala
It’s time now to unveil the conditional clause system.
726 2 kervala
727 2 kervala
728 2 kervala
729 2 kervala
730 2 kervala
Let’s say that the identifier and string value we put in a phrase in the previous step is a clause. And let’s say that a phrase can contains more than one clause that can be chosen by the translation engine on the fly depending on the parameter value. This is the conditional clause system.
731 2 kervala
732 2 kervala
733 2 kervala
734 2 kervala
735 2 kervala
Let’s start a first example. As in step 3, we want to kill creature, but this time, we add a variable number of creature to kill, from 0 to n.
736 2 kervala
737 2 kervala
What we need is conditions to select between three clause: no creature to kill, one creature to kill and more than one.
738 2 kervala
739 2 kervala
740 2 kervala
741 2 kervala
742 2 kervala
First, let’s write the phrase, its parameters and the three clauses:
743 2 kervala
744 2 kervala
745 2 kervala
746 2 kervala
747 2 kervala
KILL_A_CREATURE (race crea*, int count*)
748 2 kervala
749 2 kervala
{
750 2 kervala
751 1 kervala
// no creature to kill
752 1 kervala
753 1 kervala
754 2 kervala
[*There is no creature to kill today.*]
755 1 kervala
756 1 kervala
757 2 kervala
// 1 creature to kill
758 1 kervala
759 2 kervala
* [Would you please kill a $crea$ for me ?]*
760 2 kervala
// more than one
761 1 kervala
762 2 kervala
[Would you please kill *$count$* $crea$ for me ?]
763 1 kervala
764 2 kervala
}
765 1 kervala
766 1 kervala
767 1 kervala
768 1 kervala
769 2 kervala
We have written down three version of the text with very different meaning and gramatical structure.
770 1 kervala
771 2 kervala
Now, add the conditions. Conditions are placed before the identifier and/or string value and are marked with bracket.
772 1 kervala
773 1 kervala
774 1 kervala
775 1 kervala
776 2 kervala
KILL_A_CREATURE (race crea, int count)
777 1 kervala
778 2 kervala
{
779 1 kervala
780 2 kervala
// no creature to kill
781 1 kervala
782 2 kervala
*(count = 0) *[There is no creature to kill today.]
783 1 kervala
784 2 kervala
// 1 creature to kill
785 1 kervala
786 2 kervala
*(count = 1)* [Would you please kill a $crea$ for me ?]
787 1 kervala
788 2 kervala
// more than one
789 1 kervala
790 2 kervala
*(count > 1)* [Would you please kill $count$ $crea$ for me ?]
791 1 kervala
792 2 kervala
}
793 1 kervala
794 1 kervala
795 1 kervala
796 1 kervala
797 2 kervala
Easy! no?
798 1 kervala
799 1 kervala
800 1 kervala
801 1 kervala
802 2 kervala
Now, a more complex case: we want the phrase to speak differently to male or female player. This is the occasion to introduce the self parameter. Self parameter if a ‘hidden’ parameter that is always available and that represent the addressee of the phrase.
803 1 kervala
804 2 kervala
Self parameter support name and gender property. You can provide a self_words_<lang>.txt file to handle special case (admin player with a translatable name for example).
805 1 kervala
806 2 kervala
Let’s rewrite the killing creature request with player gender aware style:
807 1 kervala
808 1 kervala
809 1 kervala
810 1 kervala
811 2 kervala
KILL_A_CREATURE (race crea, int count)
812 1 kervala
813 2 kervala
{
814 1 kervala
815 2 kervala
// -- Male player
816 1 kervala
817 2 kervala
// no creature to kill, male player
818 1 kervala
819 2 kervala
(count = 0* & self.gender = Male*)
820 1 kervala
821 2 kervala
[Hi man, there is no creature to kill today .]
822 1 kervala
823 2 kervala
// 1 creature to kill, male player
824 1 kervala
825 2 kervala
(count = 1* & self.gender = Male*)
826 1 kervala
827 2 kervala
[Hi man, would you please kill a $crea$ for me ?]
828 1 kervala
829 2 kervala
// more than one, male player
830 1 kervala
831 2 kervala
(count > 1 *& self.gender = Male*)
832 1 kervala
833 2 kervala
[Hi man, Would you please kill $count$ $crea$ for me ?]
834 1 kervala
835 1 kervala
836 1 kervala
837 1 kervala
838 2 kervala
// -- Female player
839 1 kervala
840 2 kervala
// no creature to kill, male player
841 1 kervala
842 2 kervala
(count = 0 *& self.gender = Female*)
843 1 kervala
844 2 kervala
[Hi girl, There is no creature to kill today.]
845 2 kervala
846 2 kervala
// 1 creature to kill, male player
847 2 kervala
848 2 kervala
(count = 1 *& self.gender = Female*)
849 2 kervala
850 2 kervala
[Hi girl, Would you please kill a $crea$ for me ?]
851 2 kervala
852 2 kervala
// more than one, male player
853 2 kervala
854 2 kervala
(count > 1 *& self.gender = Female*)
855 2 kervala
856 2 kervala
[Hi girl, Would you please kill $count$ $crea$ for me ?]
857 2 kervala
858 2 kervala
}
859 2 kervala
860 2 kervala
861 2 kervala
862 2 kervala
863 2 kervala
We have six clauses now. Three case on number of creature multiplied by two cases on the gender of the player.
864 2 kervala
865 2 kervala
As you can see, conditional test can be combined with a ‘&’ character. This means that all the tests must be valid to select the clause.
866 2 kervala
867 2 kervala
868 2 kervala
869 2 kervala
870 2 kervala
You can use any parameter as left operand for the test. You can also specify a parameter property (coming from words file) as operand.
871 2 kervala
872 2 kervala
On the other hand, right test operand must be constant value (either textual or numerical value).
873 2 kervala
874 2 kervala
Available operators are =, !=, <, <=, >, >=.
875 2 kervala
876 2 kervala
877 2 kervala
878 2 kervala
879 2 kervala
In some case, you could need to make OR’ed test combination. This is possible by simply specifiying multiple condition list before a clause:
880 2 kervala
881 2 kervala
882 2 kervala
883 2 kervala
884 2 kervala
FOO_PHRASE (int c1, int c2)
885 2 kervala
886 2 kervala
{
887 2 kervala
888 2 kervala
*(c1 = 0 & c2 = 10)*
889 2 kervala
890 2 kervala
* (c1 = 10 & c2 = 0)*
891 2 kervala
892 2 kervala
[This clause is selected if :
893 2 kervala
894 2 kervala
c1 equal zero *and* c2 equal ten
895 2 kervala
896 2 kervala
*or*
897 2 kervala
898 2 kervala
c1 equal ten *and* c2 equal zero]
899 2 kervala
900 2 kervala
}
901 2 kervala
902 2 kervala
903 2 kervala
904 2 kervala
905 2 kervala
▪ Detailed clause selection rules:
906 2 kervala
907 2 kervala
* A valid clause is a clause where the conditional combination are true with a given set of parameter value.
908 2 kervala
* Clauses are evaluated in the same order as they are written in the phrase file. The first valid clause will be selected.
909 2 kervala
* If the first clause doesn’t have condition, it is used as a fallback clause when none of the conditional clauses are selected.
910 2 kervala
* If there is no fallback clause and none of the clauses are selected, then the first clause is selected.
911 2 kervala
* For the same phrase, each language can provide its own set of condition and clause to accommodate its gammatical needs.
912 2 kervala
913 2 kervala
h3. Harcoded parameters properties reference
914 2 kervala
915 2 kervala
Here you file find an exhaustive list of harcoded parameters properties.
916 2 kervala
917 2 kervala
These properties are always available even if no words files are provided.
918 2 kervala
919 2 kervala
Futhermore, the harcoded property can’t be substituted by a word file specifying a column of the same name.
920 2 kervala
921 2 kervala
922 2 kervala
923 2 kervala
924 2 kervala
*Parameter*
925 2 kervala
926 2 kervala
*Property*
927 2 kervala
928 2 kervala
Item
929 2 kervala
930 2 kervala
931 2 kervala
932 2 kervala
933 2 kervala
Place
934 2 kervala
935 2 kervala
936 2 kervala
937 2 kervala
938 2 kervala
Creature
939 2 kervala
940 2 kervala
name : model name of the creature
941 2 kervala
942 2 kervala
gender : gender of the creature from the model
943 2 kervala
944 2 kervala
Skill
945 2 kervala
946 2 kervala
947 2 kervala
948 2 kervala
949 2 kervala
Ecosystem
950 2 kervala
951 2 kervala
952 2 kervala
953 2 kervala
954 2 kervala
Race
955 2 kervala
956 2 kervala
957 2 kervala
958 2 kervala
959 2 kervala
Brick
960 2 kervala
961 2 kervala
962 2 kervala
963 2 kervala
964 2 kervala
Tribe
965 2 kervala
966 2 kervala
967 2 kervala
968 2 kervala
969 2 kervala
Guild
970 2 kervala
971 2 kervala
972 2 kervala
973 2 kervala
974 2 kervala
Player
975 2 kervala
976 2 kervala
name : name of the player
977 2 kervala
978 2 kervala
gender : gender of the player in the mirror
979 2 kervala
980 2 kervala
Bot
981 2 kervala
982 2 kervala
career : the career of the bot
983 2 kervala
984 2 kervala
role : the role of the bot as defined in creature.basics.chatProfile
985 2 kervala
986 2 kervala
name : name of the creature
987 2 kervala
988 2 kervala
gender : gender of the creature from the model
989 2 kervala
990 2 kervala
Integer
991 2 kervala
992 2 kervala
993 2 kervala
994 2 kervala
995 2 kervala
Time
996 2 kervala
997 2 kervala
998 2 kervala
999 2 kervala
1000 2 kervala
Money
1001 2 kervala
1002 2 kervala
1003 2 kervala
1004 2 kervala
1005 2 kervala
Compass
1006 2 kervala
1007 2 kervala
1008 2 kervala
1009 2 kervala
1010 2 kervala
dyn_string_id
1011 2 kervala
1012 2 kervala
Only != and == test available. Mainly to compare parameter with 0.
1013 2 kervala
1014 2 kervala
string_id
1015 2 kervala
1016 2 kervala
Only != and == test available. Mainly to compare parameter with 0
1017 2 kervala
1018 2 kervala
self
1019 2 kervala
1020 2 kervala
name : name of the player
1021 2 kervala
1022 2 kervala
gender : gender of the player in the mirror
1023 2 kervala
1024 2 kervala
creature_model
1025 2 kervala
1026 2 kervala
NB : use the creature_words translation file !
1027 2 kervala
1028 2 kervala
entity
1029 2 kervala
1030 2 kervala
== 0, != 0: test if the entity is Unknown or not.
1031 2 kervala
1032 2 kervala
name : name of the creature or name of the player.
1033 2 kervala
1034 2 kervala
gender : gender of the creature from the model or gender of the player (from the player info).
1035 2 kervala
1036 2 kervala
bodypart
1037 2 kervala
1038 2 kervala
1039 2 kervala
1040 2 kervala
1041 2 kervala
score
1042 2 kervala
1043 2 kervala
1044 2 kervala
1045 2 kervala
1046 2 kervala
sphrase
1047 2 kervala
1048 2 kervala
1049 2 kervala
1050 2 kervala
1051 2 kervala
characteristic
1052 2 kervala
1053 2 kervala
1054 2 kervala
1055 2 kervala
1056 2 kervala
damage_type
1057 2 kervala
1058 2 kervala
1059 2 kervala
1060 2 kervala
1061 2 kervala
bot_name
1062 2 kervala
1063 2 kervala
1064 2 kervala
1065 2 kervala
1066 2 kervala
h2. Translation workflow
1067 2 kervala
1068 2 kervala
In the following translation workflow, we consider that the reference language is English.
1069 2 kervala
1070 2 kervala
1071 2 kervala
1072 2 kervala
1073 2 kervala
There is a series of tools and bat file to help in getting translation in sync. Here is a step by step description of how to work on translation file, what tool to use and when.
1074 2 kervala
1075 2 kervala
1076 2 kervala
1077 2 kervala
1078 2 kervala
Only addition to existing translation file is supported by the translation tools. If you need to modify or remove existing translation string or phrase structure, this must be done ‘by hand’ with a maximum of attention to all the languages versions.
1079 2 kervala
1080 2 kervala
In most case, it is better to create a new translation entry instead of dealing with a modification in all the translations files and it’s almost safe to leave old unused string in the files.
1081 2 kervala
1082 2 kervala
At least, you should NEVER make modification when there are pendings diff file.
1083 2 kervala
1084 2 kervala
1085 2 kervala
1086 2 kervala
1087 2 kervala
*It is highly advisable to strictly respect the described workflow *in order to avoid translation problems, missing strings and other weird problems that can arise from working with many language version of a set of file.
1088 2 kervala
1089 2 kervala
1090 2 kervala
1091 2 kervala
1092 2 kervala
Translation work is done in cooperation between the publisher who is doing the ‘technical’ part of the task and a profesionnal translator contractor who only translate simple string into a very high quality and rich string with respect to the context.
1093 2 kervala
1094 2 kervala
1095 2 kervala
1096 2 kervala
1097 2 kervala
The tools that generate diff file for translation keep the comments from the reference version. This can be helpful to give additionnal information to the translator about the context of the text.
1098 2 kervala
1099 2 kervala
Moreover, for phrase files, the diff file automaticaly include comments that describe the parameter list.
1100 2 kervala
1101 2 kervala
h3. Translation repository structure
1102 2 kervala
1103 2 kervala
All files to translate are stored in a well defined directory structure called ‘the translation repository’. All translation work is done in this repository.
1104 2 kervala
1105 2 kervala
Tools are provided to install the translated file in the client and server repository after a translation cycle is done.
1106 2 kervala
1107 2 kervala
1108 2 kervala
1109 2 kervala
1110 1 kervala
translation/ Root directory for translation repository
1111 1 kervala
1112 1 kervala
1113 1 kervala
1114 1 kervala
1115 1 kervala
1116 2 kervala
languages.txt A simple text file that contains all the language code (ISO 639-2) that we are working on (eg : en, fr, etc…).
1117 1 kervala
1118 1 kervala
1119 1 kervala
1120 1 kervala
1121 2 kervala
work/ This is the starting point for addition of new content. This directory contains any files that can be edited for addition.
1122 1 kervala
1123 1 kervala
1124 1 kervala
1125 1 kervala
1126 2 kervala
diff/ Contains all diff files generated by tools. This is where most of the work is done. After the merge operation is applied to integrate translated diff into translated file, the diff file are moved to the history directory.
1127 1 kervala
1128 2 kervala
When diff files are generated, they are prefixed with a version number automaticaly computed from the current Unix time. This permits to generate new diff file without waiting for diff translation to be done. More, when you generate new diff file with existing none merged diff, new diff only contains the new difference (is it clear or what?  ).
1129 1 kervala
1130 1 kervala
1131 1 kervala
1132 1 kervala
1133 2 kervala
history/ Contains all the diff files that have been translated and merged. This is for backup and security reason.
1134 1 kervala
1135 1 kervala
1136 1 kervala
1137 1 kervala
1138 2 kervala
translated/ Contains all translated file. The content of this directory is installed into client and server repository when translation cycle is done. You should never change anything by hand in this directory unless you now exactly what you are doing.
1139 1 kervala
1140 2 kervala
h3. Client side static string
1141 1 kervala
1142 1 kervala
1143 1 kervala
1144 1 kervala
1145 2 kervala
*Initial task:*
1146 1 kervala
1147 2 kervala
Publisher
1148 1 kervala
1149 2 kervala
* Creates the reference file en.uxt in the work directory, fill in the required first string ‘LanguageName’ then add any number of string for the English version.
1150 2 kervala
* Generates static string diff files with the command make_string_diff.bat. This will create diff files for each language in the diff directory.
1151 2 kervala
* Send the diff files to the Translator.
1152 1 kervala
1153 2 kervala
Translator
1154 1 kervala
1155 2 kervala
* Translate the diff files.
1156 2 kervala
* Send them back to the Publisher.
1157 1 kervala
1158 2 kervala
Publisher
1159 1 kervala
1160 2 kervala
* Put the translated diff files in the diff directory (this will overwrite non translated diff files with translated one).
1161 2 kervala
* Merge the translated diff files with the command merge_string_diff.bat. This will create the <lang>.uxt files for each language in the translated directory and move the diff in the history directory.
1162 1 kervala
1163 1 kervala
1164 1 kervala
1165 1 kervala
1166 2 kervala
After the initial task is done, the workflow enters the in incremental mode.
1167 1 kervala
1168 1 kervala
1169 1 kervala
1170 1 kervala
1171 2 kervala
*Incremental task:*
1172 1 kervala
1173 2 kervala
Publisher
1174 1 kervala
1175 2 kervala
* Add string in the reference file en.uxt in the addtion directory.
1176 2 kervala
* Generates static string diff files with the command make_string_diff.bat. This will create diff files for each language in the diff directory.
1177 2 kervala
* Send the diff files to the Translator.
1178 1 kervala
1179 2 kervala
Translator
1180 1 kervala
1181 2 kervala
* Translate the diff files.
1182 2 kervala
* Send them back to the Publisher.
1183 1 kervala
1184 2 kervala
Publisher
1185 1 kervala
1186 2 kervala
* Put the translated diff files in the diff directory (this will overwrite non translated diff files with translated one).
1187 2 kervala
* Merge the translated diff files with the command merge_string_diff.bat. This will apply the diff files to the <lang>.uxt files for each language in the translated directory and move the diff in the history directory.
1188 1 kervala
1189 2 kervala
h3. Server side dynamic string
1190 1 kervala
1191 2 kervala
*Initial task:*
1192 1 kervala
1193 2 kervala
Publisher
1194 1 kervala
1195 2 kervala
* Creates the reference file phrase_en.uxt in the addition directory and add any number of phrase entries for the English version.
1196 2 kervala
* Generates phrase diff files with the command make_phrase_diff.bat. This will create diff files for each language in the diff directory.
1197 2 kervala
* Translate the phrase diff file. This implie good knowledge of gramatical structure of each language to accommodate clause selection rules.
1198 2 kervala
* Merge the translated diff with the command merge_phrase_diff.bat. This will create all the phrase_<lang>.txt in the translated directory from the translated diff then move diff files to history directory.
1199 2 kervala
* Generates clauses diff file with the command make_clause_diff.bat. This create clause diff file in the diff directory for all language.
1200 2 kervala
* Send the clause diff files to the Translator
1201 1 kervala
1202 2 kervala
Translator
1203 1 kervala
1204 2 kervala
* Translate the clause diff files.
1205 2 kervala
* Send them back to the Publisher.
1206 1 kervala
1207 2 kervala
Publisher
1208 1 kervala
1209 2 kervala
* Put the translated clause diff files in the diff directory (this will overwrite non translated clause diff files with translated one).
1210 2 kervala
* Merge the translated clause diff files with the command merge_clause_diff.bat. This will create the clause_<lang>.txt files for each language in the translated directory and move the diff in the history directory.
1211 1 kervala
1212 1 kervala
1213 1 kervala
1214 1 kervala
1215 2 kervala
After the initial task is done, the workflow enters the in incremental mode.
1216 1 kervala
1217 1 kervala
1218 1 kervala
1219 1 kervala
1220 2 kervala
*Incremental task:*
1221 1 kervala
1222 2 kervala
Publisher
1223 1 kervala
1224 2 kervala
* Add new phrase in phrase_en.uxt in the addition directory.
1225 2 kervala
* Generates phrase diff files with the command make_phrase_diff.bat. This will create diff files for each language in the diff directory.
1226 2 kervala
* Translate the phrase diff file. This implie good knowledge of gramatical structure of each language to accommodate clause selection rules.
1227 2 kervala
* Merge the translated diff with the command merge_phrase_diff.bat. This will append the diff to there repective phrase_<lang>.txt file in the translated directory then move diff files to history directory.
1228 2 kervala
* Generates clauses diff file with the command make_clause_diff.bat. This create clause diff file in the diff directory.
1229 2 kervala
* Send the clause diff files to the Translator
1230 2 kervala
1231 2 kervala
Translator
1232 2 kervala
1233 2 kervala
* Translate the clause diff files.
1234 2 kervala
* Send them back to the Publisher.
1235 2 kervala
1236 2 kervala
Publisher
1237 2 kervala
1238 2 kervala
* Put the translated clause diff files in the diff directory (this will overwrite non translated clause diff files with translated one).
1239 2 kervala
* Merge the translated clause diff files with the comment merge_clause_diff.bat. This will append the diff file to there repective clause_<lang>.txt files for each language in the translated directory and move the diff in the history directory.
1240 2 kervala
1241 2 kervala
h3. Server side words files
1242 2 kervala
1243 2 kervala
NB: ‘words’ has nothing to do with the microsoft program Word!
1244 2 kervala
1245 2 kervala
1246 2 kervala
1247 2 kervala
1248 2 kervala
Words files are always updated by hands because they are rarely updated by the publisher (and generaly, this will be for big update). Moreover, when new phrase are translated, it can be necessary to create and fill new column in one of the words file to accommodate the translation.
1249 2 kervala
1250 2 kervala
1251 2 kervala
1252 2 kervala
1253 2 kervala
So, there is only a workflow but no tools.
1254 2 kervala
1255 2 kervala
1256 2 kervala
1257 2 kervala
1258 2 kervala
*Initial task:*
1259 2 kervala
1260 2 kervala
Publisher
1261 2 kervala
1262 2 kervala
* Build the initial sheet for each type of parameter with all the possible identifier in the reference language in the translated directory.
1263 2 kervala
* Create and fill the default ‘name’ and ‘p’ columns.
1264 2 kervala
* Create the sheets for all languages by copying the reference language sheets.
1265 2 kervala
* Create and fill any basic column depending on languages.
1266 2 kervala
* Sends all the sheets to the Translator.
1267 2 kervala
1268 2 kervala
Translator
1269 2 kervala
1270 2 kervala
* Translate all the sheets in all language, eventualy, create any needed columns.
1271 2 kervala
* Send back the translated sheets to the Publisher.
1272 2 kervala
* Keep a copy of the translated sheets as reference for phrase and clause translation.
1273 2 kervala
1274 2 kervala
Publisher
1275 2 kervala
1276 2 kervala
* Put the translated sheets in the translated directory, overwriting old ones.
1277 2 kervala
1278 2 kervala
1279 2 kervala
1280 2 kervala
1281 2 kervala
After this initial task, there is two possible events:
1282 2 kervala
1283 2 kervala
1284 2 kervala
1285 2 kervala
1286 2 kervala
*New column(s) needed:*
1287 2 kervala
1288 2 kervala
Translator
1289 2 kervala
1290 2 kervala
* While translating phrase or clause diff, it comes that one or more new columns are needed for some language and parameter type.
1291 2 kervala
* Define the needed columns
1292 2 kervala
* Contact Publisher to check that no sheets updates are pending. If yes, first apply the ‘new sheets content’ workflow.
1293 2 kervala
* Add and fill the new columns into the concerned sheets/langs.
1294 2 kervala
* Send the sheets to the Publisher.
1295 2 kervala
1296 2 kervala
Publisher
1297 2 kervala
1298 2 kervala
* Put the new sheets in the translated directory, overwriting old ones.
1299 2 kervala
1300 2 kervala
1301 2 kervala
 *New sheets content:*
1302 2 kervala
Publisher:
1303 2 kervala
1304 2 kervala
* New game content is to be integrated in the game.
1305 2 kervala
* Contact Translator to check that no sheets updates are pending. If yes, first apply the ‘new column(s) needed’ workflow.
1306 2 kervala
* Create new sheets for the reference language and containing only the new content.
1307 2 kervala
* Add and fill the default columns in the new sheets (see ‘Initial task’).
1308 2 kervala
* Create new sheets for all the languages by copying the reference languages sheets.
1309 2 kervala
* Add but DON’T FILL all the columns to repect the current sheet format for each type, each language.
1310 2 kervala
* Send the new sheets to the Translator.
1311 2 kervala
1312 2 kervala
Translator:
1313 2 kervala
1314 2 kervala
* Translate the new sheets.
1315 2 kervala
* Append the new sheets at the end of the existing sheets.
1316 2 kervala
* Send the merge result to the Pushisher.
1317 2 kervala
* Keep the merge result as reference for phrase and clause translation and futur content addition.
1318 2 kervala
1319 2 kervala
Publisher:
1320 2 kervala
1321 2 kervala
* Put the new sheets in the translated directory, overwriting old ones.
1322 2 kervala
1323 2 kervala
1324 2 kervala
 *Installing the translated files*
1325 2 kervala
After a cycle of translation is terminated, you must install the translated files into the client and servers directory strucure.
1326 2 kervala
1327 2 kervala
1328 2 kervala
1329 2 kervala
1330 2 kervala
This is done via the command intall_translation.bat.
1331 2 kervala
1332 2 kervala
The <lang>.uxt file are copied into the client strucure in Ryzom/gamedev/language.
1333 2 kervala
1334 2 kervala
All the other files are copied in Ryzom/data_shard.
1335 2 kervala
1336 2 kervala
1337 2 kervala
1338 2 kervala
1339 2 kervala
To apply client side translation, Publisher needs to make a patch.
1340 2 kervala
1341 2 kervala
To apply server side translation, just enter the command ‘reload’ on the InputOutputService.
1342 2 kervala
1343 2 kervala
h2. Working with translation files: programmer view
1344 2 kervala
1345 2 kervala
As a NeL/Ryzom programmer, you can use the translation system with a very few calls.
1346 2 kervala
1347 2 kervala
h3. Accessing client static strings
1348 2 kervala
1349 2 kervala
To obtain a unicode string from a string identifier, you use the NLMISC::CI18N class.
1350 2 kervala
1351 2 kervala
1352 2 kervala
1353 2 kervala
1354 2 kervala
First of all, you must ensure that the translation file *.uxt are available in the search path.
1355 2 kervala
1356 2 kervala
Then, you can load a language string set by calling NLMISC::CI18N::load(languageCode).
1357 2 kervala
1358 2 kervala
The parameter languageCode is the language code as defined in chapter 2 “Language code”.
1359 2 kervala
1360 2 kervala
After that, call the method NLMISC::CI18N::get(identifier) to obtain the unicode string associated to identifier.
1361 2 kervala
1362 2 kervala
h3. Dynamic strings
1363 2 kervala
1364 1 kervala
Dynamic string requires a bit more work and a complete shard infrastructure.
1365 2 kervala
1366 2 kervala
1367 2 kervala
1368 2 kervala
1369 2 kervala
Dynamic string management involves a requesting service (RQS), the InputOutputService (IOS), the FrontEnd (FE), the ryzom client plus the basic services to run the other (naming, tick, mirror).
1370 2 kervala
1371 3 kervala
!dhkn9n8t_20d35g5n6d_b.gif!
1372 2 kervala
1373 2 kervala
RQS is a service that wants to send a dynamic string to the client.
1374 2 kervala
1375 2 kervala
RQS also send the dynamic string identifier to the client by using the database or any other way.
1376 2 kervala
1377 2 kervala
The proxy is a small piece of code that builds and sends the PHRASE message to IOS service.
1378 2 kervala
1379 2 kervala
IOS make the big task of parsing parameter, selecting the good clause and building the resulting string then sending a minimum amount of data to the client.
1380 2 kervala
1381 2 kervala
The client receives the phrase and requests any missing string element to the IOS.
1382 2 kervala
1383 2 kervala
1384 2 kervala
 *Building parameter list and sending the string*
1385 2 kervala
To access the proxy function, you need to include game_share/string_manager_sender.h and link with game_share.lib.
1386 2 kervala
1387 2 kervala
1388 2 kervala
1389 2 kervala
1390 2 kervala
You first need to build the parameters list. This is done by filling a vector of STRING_MANAGER::TParam struture. For each parameter, you must set the Type field then write the appropriate member data.
1391 2 kervala
1392 2 kervala
You MUST exactly respect the phrase parameter definition in the phrase file.
1393 2 kervala
1394 2 kervala
1395 2 kervala
1396 2 kervala
1397 2 kervala
Then, you can call
1398 2 kervala
1399 2 kervala
uint32 STRING_MANAGER::*sendStringToClient*(
1400 2 kervala
1401 2 kervala
NLMISC::CEntityId destClientId,
1402 2 kervala
1403 2 kervala
const std::string &phraseIdentifier,
1404 2 kervala
1405 2 kervala
const std::vector<STRING_MANAGER::TParam> parameters)
1406 2 kervala
1407 2 kervala
destClientId is the entity id of the destination client, phraseIdentifier is the indentifier like writen in the phrase file, parameters is the vector of parameter you have build before.
1408 2 kervala
1409 2 kervala
This function returns the dynamic ID that is assigned to this phrase.
1410 2 kervala
1411 2 kervala
1412 2 kervala
1413 2 kervala
1414 2 kervala
Example : sending the ‘kill a creature’ phrase (see § 5.2, step 4) :
1415 2 kervala
1416 2 kervala
1417 2 kervala
1418 2 kervala
1419 2 kervala
// include the string manager proxy definition
1420 2 kervala
1421 2 kervala
#include “game_share/string_manager_sender.h”
1422 2 kervala
1423 2 kervala
1424 2 kervala
1425 2 kervala
1426 2 kervala
uint32 killCreatureMessage(
1427 2 kervala
1428 2 kervala
EntityId destClient,
1429 2 kervala
1430 2 kervala
GSPEOPLE::EPeople race,
1431 2 kervala
1432 2 kervala
uint32 nbToKill)
1433 2 kervala
1434 2 kervala
{
1435 2 kervala
1436 2 kervala
std::vector<STRING_MANAGER::TParam> params;
1437 2 kervala
1438 2 kervala
STRING_MANAGER::TParam param;
1439 2 kervala
1440 2 kervala
1441 2 kervala
1442 2 kervala
1443 2 kervala
// first, we need the creature race
1444 2 kervala
1445 2 kervala
param.Type = STRING_MANAGER::creature;
1446 2 kervala
1447 2 kervala
param.Enum = race;
1448 2 kervala
1449 2 kervala
params.push_back(param);
1450 2 kervala
1451 2 kervala
1452 2 kervala
1453 2 kervala
1454 2 kervala
// second, the number of creature to kill
1455 2 kervala
1456 2 kervala
param.Type = STRING_MANAGER::integer;
1457 2 kervala
1458 2 kervala
param.Int = nbToKill;
1459 2 kervala
1460 2 kervala
params.push_back(param);
1461 2 kervala
1462 2 kervala
1463 2 kervala
1464 2 kervala
1465 2 kervala
// and now, send the message
1466 2 kervala
1467 2 kervala
uint32 dynId = STRING_MANAGER::sendStringToClient(
1468 2 kervala
1469 2 kervala
destClient,
1470 2 kervala
1471 2 kervala
“KILL_A_CREATURE”,
1472 2 kervala
1473 2 kervala
params);
1474 2 kervala
1475 2 kervala
1476 2 kervala
1477 2 kervala
1478 2 kervala
return dynId;
1479 2 kervala
1480 1 kervala
}
1481 1 kervala
1482 1 kervala
1483 1 kervala
1484 1 kervala
1485 1 kervala
1486 2 kervala
*Member to fill in TParam depending on the type of parameter:*
1487 1 kervala
1488 2 kervala
item: Fill SheetId with the sheet id of the item
1489 1 kervala
1490 2 kervala
place: Fill Identifier string with the place identifier
1491 1 kervala
1492 2 kervala
creature: Fill EId with the creature entity id
1493 1 kervala
1494 2 kervala
skill: Fill Enum with the enum value from SKILLS::ESkills
1495 1 kervala
1496 2 kervala
ecosystem: Fill Enum with the enum value from ECOSYSTEM::EEcosystem
1497 1 kervala
1498 2 kervala
race: Fill Enum with the enum value from GSPEOPLE::EPeople
1499 1 kervala
1500 2 kervala
brick: Fill SheetId with the sheet id of the brick
1501 1 kervala
1502 2 kervala
tribe: not defined yet
1503 1 kervala
1504 2 kervala
guild: not defined yet
1505 1 kervala
1506 2 kervala
player: Fill EId with the player entity id
1507 1 kervala
1508 2 kervala
bot: Fill EId with the bot entity id
1509 1 kervala
1510 2 kervala
integer: Fill Int with the integer value (sint32)
1511 1 kervala
1512 2 kervala
time: Fill Time with the time value (uint32)
1513 1 kervala
1514 2 kervala
money: Fill Money with the money value (uint64)
1515 1 kervala
1516 2 kervala
compass: not defined yet
1517 1 kervala
1518 2 kervala
dyn_string_id: Fill StringId with a dynamic string id
1519 1 kervala
1520 2 kervala
string_id: Fill StringId with a string id
1521 1 kervala
1522 2 kervala
creature_model: Fill SheetId with the sheet id of the creature
1523 1 kervala
1524 2 kervala
entity: Fill EId with the creature,npc or player entity
1525 2 kervala
1526 2 kervala
body_part: Fill Enum with the enum value from BODY::TBodyPart
1527 2 kervala
1528 2 kervala
score: Fill Enum with the enum value from SCORES::TScores
1529 2 kervala
1530 2 kervala
sphrase: Fill SheetId with the sheet id of the phrase
1531 2 kervala
1532 2 kervala
characteristic: Fill Enum with the enum value from CHARACTERISTICS::TCharacteristic
1533 2 kervala
1534 2 kervala
damage_type: Fill Enum with the enum value from DMGTYPE::EDamageType
1535 2 kervala
1536 2 kervala
bot_name: Fill Identifier with the bot name without function.
1537 2 kervala
1538 2 kervala
literal: Fill Literal with the Unicode literal string.
1539 2 kervala
1540 2 kervala
1541 2 kervala
 *Accessing the dynamic string from the client*
1542 2 kervala
On the client side, accessing the dynamic string is pretty easy. You only need to take care of transmission delay in certain case.
1543 2 kervala
1544 2 kervala
1545 2 kervala
1546 2 kervala
1547 2 kervala
Once you get the dynamic string id from anyway (eg database), you just need to pol the getDynString method of STRING_MANAGER::CStringManagerClient.
1548 2 kervala
1549 2 kervala
The method return false until the requested string is incomplete or unknown.
1550 2 kervala
1551 2 kervala
Even when the method return false, it could return a partial text with missing replacement text.
1552 2 kervala
1553 2 kervala
Dynamic strings are dynamicaly stored, and if your code is smart enough, it could release the dynamic string memory when they are no more needed by calling releaseDynString.
1554 2 kervala
1555 2 kervala
In order to be efficient, one can call each frame the getDynString method until it return true, then store away the string and call the releaseDynString.
1556 2 kervala
1557 2 kervala
1558 2 kervala
1559 2 kervala
1560 2 kervala
STRING_MANAGER::CStringManagerClient is based on the singleton pattern so you must call STRING_MANAGER::CStringManagerClient::instance() to get a pointer to the singleton instance.
1561 2 kervala
1562 2 kervala
1563 2 kervala
1564 2 kervala
1565 2 kervala
Here is a simple code sample.
1566 2 kervala
1567 2 kervala
1568 2 kervala
1569 2 kervala
1570 2 kervala
// include the string manager client definition
1571 2 kervala
1572 2 kervala
#include “string_manager_client.h”
1573 2 kervala
1574 2 kervala
1575 2 kervala
1576 2 kervala
1577 2 kervala
using namespace STRING_MANAGER;
1578 2 kervala
1579 2 kervala
1580 2 kervala
1581 2 kervala
1582 2 kervala
/** A method that receive the dynamic string id
1583 2 kervala
1584 2 kervala
* and print the dynamic string in the log.
1585 2 kervala
1586 2 kervala
* Call it each frame until it return true.
1587 2 kervala
1588 2 kervala
*/
1589 2 kervala
1590 2 kervala
bool foo(uint32 dynStringId)
1591 2 kervala
1592 2 kervala
{
1593 2 kervala
1594 2 kervala
ucstring result;
1595 2 kervala
1596 2 kervala
bool ret;
1597 2 kervala
1598 2 kervala
CStringManagerClient *smc = CStringManagerClient::instance();
1599 2 kervala
1600 2 kervala
1601 2 kervala
1602 2 kervala
1603 2 kervala
ret = smc->getDynamicString(dynStringId, result)
1604 2 kervala
1605 2 kervala
1606 2 kervala
1607 2 kervala
if (!ret)
1608 2 kervala
1609 2 kervala
nlinfo(“Incomplete string : %s”, result.toString().c_str());
1610 2 kervala
1611 2 kervala
else
1612 2 kervala
1613 2 kervala
{
1614 2 kervala
1615 2 kervala
nlinfo(“Complete string : %s”, result.toString().c_str());
1616 2 kervala
1617 2 kervala
// release the dynamic string
1618 2 kervala
1619 2 kervala
smc->releaseDynString(dynStringId);
1620 2 kervala
1621 2 kervala
}
1622 2 kervala
1623 2 kervala
1624 2 kervala
1625 2 kervala
1626 2 kervala
return ret;
1627 2 kervala
1628 2 kervala
}
1629 2 kervala
1630 2 kervala
h1. Ryzom text creation guide
1631 2 kervala
1632 2 kervala
1633 2 kervala
1634 2 kervala
1635 2 kervala
1636 2 kervala
There are many place for text in Ryzom, this page will clarify the text identification conventions, the available context for text insertion and contextual text parameters.
1637 2 kervala
1638 2 kervala
h2. 1. Identifier conventions
1639 2 kervala
1640 2 kervala
h3. 1.1. Strings identifiers in en.uxt
1641 2 kervala
1642 2 kervala
These identifiers are written lower case with capital at start of each new word.
1643 2 kervala
1644 2 kervala
Example:
1645 2 kervala
1646 2 kervala
aSimpleIdentifier
1647 2 kervala
1648 2 kervala
anotherIdentifier
1649 2 kervala
1650 2 kervala
1651 2 kervala
1652 2 kervala
h3. 1.2. Phrases identifiers in phrase_en.txt
1653 2 kervala
1654 2 kervala
These identifiers are written in capitals, words are separated with an underscore.
1655 2 kervala
1656 2 kervala
Example:
1657 2 kervala
1658 2 kervala
A_SIMPLE_IDENTIFIER
1659 2 kervala
1660 2 kervala
ANOTHER_IDENTIFIER
1661 2 kervala
1662 2 kervala
1663 2 kervala
1664 2 kervala
h3. 1.3. Strings (or clauses) identifiers in clause_en.txt
1665 2 kervala
1666 2 kervala
These identifiers are written like strings identifiers in en.uxt.
1667 2 kervala
1668 2 kervala
But, as they are inside a phrase definition, they must contains the name of the phrases as base name. The phrases name is lowered to respect the string identifiers convention.
1669 2 kervala
1670 2 kervala
Example:
1671 2 kervala
1672 2 kervala
In a phrase named A_SIMPLE_LABEL, the identifier should be
1673 2 kervala
1674 2 kervala
aSimpleLabel
1675 2 kervala
1676 2 kervala
1677 2 kervala
1678 2 kervala
Furthermore, when there is more than one clause for a given phrase, the clause identifier must be followed by some tags that give clues to the translator about the meaning of each clause.
1679 2 kervala
1680 2 kervala
Example:
1681 2 kervala
1682 2 kervala
In a phrases named A_SIMPLE_LABEL and that contains two clauses, one for singular, the other for plural, we could have the following two identifiers:
1683 2 kervala
1684 2 kervala
aSimpleLabelS
1685 2 kervala
1686 2 kervala
aSimpleLabelP
1687 2 kervala
1688 2 kervala
1689 2 kervala
1690 2 kervala
1691 2 kervala
1692 2 kervala
h2. 2. Text contexts
1693 2 kervala
1694 2 kervala
h3. 2.1. Chat contexts
1695 2 kervala
1696 2 kervala
Chat context cover any texts that come from an NPC through the chat windows and text bubbles.
1697 2 kervala
1698 2 kervala
h4. 2.1.1- Bot says/shout around
1699 2 kervala
1700 2 kervala
There is only one parameter available: the npc entity that say/shout.
1701 2 kervala
1702 2 kervala
Phrase name start with SAY_
1703 2 kervala
1704 2 kervala
Phrase sample:
1705 2 kervala
1706 2 kervala
SAY_XXX (bot b)
1707 2 kervala
1708 2 kervala
{
1709 2 kervala
1710 2 kervala
sayXxx [Hello there, my name’s $b$, anybody hear me?]
1711 2 kervala
1712 2 kervala
}
1713 2 kervala
1714 2 kervala
h4. 2.1.2- Bot talk to escort leader (a player)
1715 2 kervala
1716 2 kervala
Two parameters: the bot that talk and the player.
1717 2 kervala
1718 2 kervala
Phrase name start with TALK_
1719 2 kervala
1720 2 kervala
Phrase sample:
1721 2 kervala
1722 2 kervala
TALK_XXX (bot b, player p)
1723 2 kervala
1724 2 kervala
{
1725 2 kervala
1726 2 kervala
talkXxx [Hello $p$, my name’s $b$, I need help !]
1727 2 kervala
1728 2 kervala
}
1729 2 kervala
1730 2 kervala
h4. 2.1.3- Bot says/shout in response to target click
1731 2 kervala
1732 2 kervala
Two parameters: the bot clicked and the player.
1733 2 kervala
1734 2 kervala
Phrase name start with CLICK_
1735 2 kervala
1736 2 kervala
Phrase sample:
1737 2 kervala
1738 2 kervala
CLICK_XXX (bot b, player p)
1739 2 kervala
1740 2 kervala
{
1741 2 kervala
1742 2 kervala
clickXxx [Hello $p$, my name’s $b$, did you click me ?]
1743 2 kervala
1744 2 kervala
}
1745 2 kervala
1746 2 kervala
1747 2 kervala
1748 2 kervala
h3. 2.2. Interactive context (aka botchat)
1749 2 kervala
1750 2 kervala
Botchat cover any texts that come in the interactive NPC dialog.
1751 2 kervala
1752 2 kervala
1753 2 kervala
1754 2 kervala
h4. 2.2.1- Mission related phrases
1755 2 kervala
1756 2 kervala
Static missions
1757 2 kervala
1758 2 kervala
All phrase name related to mission have of root defined by the name of the mission as placed in the world editor mission node.
1759 2 kervala
1760 2 kervala
From this root, there are several extension that must be appended to form the phrase names:
1761 2 kervala
1762 2 kervala
_TITLE for mission title
1763 2 kervala
1764 2 kervala
_STEP_X for step X text (mission step start from 1)
1765 2 kervala
1766 2 kervala
_END for the mission end text.
1767 2 kervala
1768 2 kervala
Example:
1769 2 kervala
1770 2 kervala
Given a mission named INSTRUCTOR_MIS_1,
1771 2 kervala
1772 2 kervala
The mission title will be INSTRUCTOR_MIS_1_TITLE,
1773 2 kervala
1774 2 kervala
Step 1 mission text will be INSTRUCTOR_MIS_1_STEP_1,
1775 2 kervala
1776 2 kervala
Step 2 mission text will be INSTRUCTOR_MIS_1_STEP_2,
1777 2 kervala
1778 2 kervala
Mission end text will be INSTRUCTOR_MIS_1_END
1779 2 kervala
1780 2 kervala
1781 2 kervala
1782 2 kervala
Parameters:
1783 2 kervala
1784 2 kervala
XXXXXXX_TITLE (bot b, player p)
1785 2 kervala
1786 2 kervala
-b est le bot à qui le joueur parle
1787 2 kervala
1788 2 kervala
-p est le joueur
1789 2 kervala
1790 2 kervala
XXXXXXX_STEP_X (bot giver, bot current, bot target, bot previous, player p)
1791 2 kervala
1792 2 kervala
- giver est le donneur de la mission
1793 2 kervala
1794 2 kervala
- current est le bot à qui le joueur parle
1795 2 kervala
1796 2 kervala
- target est le bot à aller voir pour la prochaine etape
1797 2 kervala
1798 2 kervala
- previous est le bot vu à l'étape précédente
1799 2 kervala
1800 2 kervala
- p est le joueur
1801 2 kervala
1802 2 kervala
1803 2 kervala
1804 2 kervala
XXXXX_END (bot current, bot giver, bot previous, player p)
1805 2 kervala
1806 2 kervala
- giver est le donneur de la mission
1807 2 kervala
1808 2 kervala
- current est le bot à qui le joueur parle
1809 2 kervala
1810 2 kervala
- previous est le bot vu à l'étape précédente
1811 2 kervala
1812 2 kervala
- p est le joueur
1813 2 kervala
1814 2 kervala
1815 2 kervala
1816 2 kervala
1817 2 kervala
1818 2 kervala
Les paramètres des textes d'étapes du journal dépendent de la nature de l'étape (voir avec Nicolas Brigand).
1819 2 kervala
1820 2 kervala
1821 2 kervala
1822 2 kervala
Pour les textes de progression de mission dans le menu contextuel, il en existe deux :
1823 2 kervala
1824 2 kervala
1825 2 kervala
 MISSION_STEP_GIVE_ITEM_CONTEXT (bot giver, bot previous, item i)
1826 2 kervala
 MISSION_STEP_TALK_CONTEXT (bot giver, bot previous)
1827 2 kervala
1828 2 kervala
1829 2 kervala
1830 2 kervala
Le premier est le texte standard, le second est affiché quand on doit donner quelque chose au bot.
1831 2 kervala
1832 2 kervala
1833 2 kervala
1834 2 kervala
1835 2 kervala
1836 2 kervala
h4. 2.2.2- Additional context menu entry
1837 2 kervala
1838 2 kervala
It is possible to add simple ‘informational’ entry in the bot contextual menu. This item is composed of two phrases: the menu entry display name and the text content displayed after clicking the menu entry.
1839 2 kervala
1840 2 kervala
Two parameters: the bot supporting the context menu and the player.
1841 2 kervala
1842 2 kervala
Phrase name start with BC_MENU_ for menu entry and BC_MENUTEXT_
1843 2 kervala
1844 2 kervala
1845 2 kervala
1846 2 kervala
h3. 2.3. System message (e.g. combat info)
1847 2 kervala
1848 2 kervala
Parameters are phrases dependent, but there are some well defined phrases types:
1849 2 kervala
1850 2 kervala
COMBAT_
1851 2 kervala
1852 2 kervala
MAGIC_
1853 2 kervala
1854 2 kervala
HARVEST_
1855 2 kervala
1856 2 kervala
CRAFT_
1857 2 kervala
1858 2 kervala
DEATH_
1859 2 kervala
1860 2 kervala
PROGRESS_
1861 2 kervala
1862 2 kervala
h3. 3.4. None of the above…