LocalizationSystem

Version 3 (kervala, 04/21/2012 11:40 am)

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