LocalizationSystem

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