You're not registered yet. Click here to register. Credits 
You can register here for free.
This topic has 17 replies
and has been read 528 times
 Practical tips for translation of *.lang files (Localization)
pages 1 | 2
Scotty Offline

Administrator


Posts: 3.595

Sun Nov 04, 2012 9:02 pm
Localization with Po-files alternatively to Ini Quote · reply

First releases of Scrabble3D have had rather simple localizations by 'identifier=translation'. Usually, the localization is done with po-files [1] that hold not only identifier and translation but origin, comments and other stuff as well. Scrabble3D will support this format starting with v28c. Some special notes:

* Linebreaks can be added per \n (instead of \\n in ini-format)
* Header should consists of at least "Project-Id-Version" (used as internal release information), Last-Translator and PO-Revision-Date (shown in the configuration dialog), Language (Posix locale [2], e.g. en_GB; used to select right plural formula), and the not standardized entry BiDiMode to setup RightToLeft mode.

Zitat von Header
msgid ""
msgstr ""
"Project-Id-Version: 1000001\n"
"Report-Msgid-Bugs-To: undefined\n"
"POT-Creation-Date: 4-11-12\n"
"PO-Revision-Date: 4-11-12\n"
"Last-Translator: undefined\n"
"Language-Team: undefined\n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n!=1;\n"
"X-Generator: Scrabble3D\n"
"BiDiMode: LeftToRight\n"


* Origin of a text can be found in msgctxt (shown prominently in poedit)
* msgid contains the original value, msgstr the translation (if no translation is specified the original value will be used)
* Entries that are added to an existing file are commented with # New Item

Zitat von New item
# New Item
#: ulanguage.rtest
msgctxt "ulanguage.rtest"
msgid "Test"
msgstr ""


* Entries that are not used anymore are removed completely from the file. After loading a file it is rewritten automatically.
* Changed entries are commented with the current term (the old one can be found in msgid)

Zitat von Changed item
# Changed to Test1
#: ulanguage.rtest
msgctxt "ulanguage.rtest"
msgid "Test"
msgstr ""


* Comments can be removed safely with poedit
* Scrabble3D creates a new default.lang on start with all strings in po format, of course without translation. This file will be overwritten on the next start.
* Plurals are added either by poedit (or any other po editor), after pluralforms have been assigned correctly to the header. Or you can use a text editor.

Zitat von Plural forms
#: ulanguage.rmain_lettersexchanged
msgctxt "ulanguage.rmain_lettersexchanged"
msgid "%d letter has been exchanged"
msgid_plural "%d letters have been exchanged"
msgstr[0] "Ein Buchstabe wurde ausgetauscht"
msgstr[1] "Es wurden %d Buchstaben ausgetauscht"


* Plural forms can be added to ini format as well. Use a pipe token as separator.

Zitat von Plural forms with ini style
rmain_lettersexchanged=Ein Buchstabe wurde ausgetauscht|Es wurden %d Buchstaben ausgetauscht.


* Plurals can only be assigned to those items that have a msgid_plural info (po) or a pipe token (ini) respectively
* Items in Ini files are not removed, and not marked as new or changed


[1] http://www.gnu.org/software/gettext/manu...e/PO-Files.html
[2] http://gcc.gnu.org/onlinedocs/libstdc++/...calization.html


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


akerbeltzalba Offline




Posts: 142

Mon Nov 05, 2012 9:25 pm
#2 RE: Localization with Po-files alternatively to Ini Quote · reply

Sounds reasonable to me, I'll try and steal some time this week to try the latest test version (I assume there is one); it's just that this MS project for Office 15 is in the last push before Xmas and things are a leeeeetle insane here.

*******************************
Do, or do not. There is no try.


Scotty Offline

Administrator


Posts: 3.595

Tue Nov 13, 2012 11:50 am
#3 RE: Localization with Po-files alternatively to Ini Quote · reply

Edit: %w-Feature has been removed completely.

As a goody you can use numerals in pluralforms. To do so just replace %d (or %s) by a %w and translate rNumeralZero..rNumeralTwelve. All numbers between 0 and 12 will be replaced by the corresponding numeral.

Example:

1
2
 
rmain_lettersexchanged=Ein Buchstabe wurde ausgetauscht|Es wurden %w Buchstaben ausgetauscht.
rnumeraltwo=zwei
 

respectively

1
2
3
4
5
6
7
8
9
10
11
 
#: ulanguage.rmain_lettersexchanged
msgctxt "rmain_lettersexchanged"
msgid "%d letter has been exchanged"
msgid_plural "%d letters have been exchanged"
msgstr[0] "Ein Buchstabe wurde ausgetauscht."
msgstr[1] "Es wurden %w Buchstaben ausgetauscht."
 
#: ulanguage.rnumeraltwo
msgctxt "ulanguage.rnumeraltwo"
msgid "zwei"
msgstr ""
 

results in

1
 
Es wurden zwei Buchstaben ausgetauscht.
 

Last but not least, pluralforms are resistant to mix-up of %d and %s.

(Works not until v28e and only for strings with pluralforms)


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Bussinchen Online




Posts: 2

Tue Nov 13, 2012 12:19 pm
#4 RE: Localization with Po-files alternatively to Ini Quote · reply

How about Russian/Slovak plurals? How about plurals in ini?

Cf: http://www.liganda.ch/HTML/01_HTML_Language/SLK_Zahl.htm

Zitat von http://www.liganda.ch/HTML/01_HTML_Language/SLK_Zahl.htm
Slovak: Flexion der gezählten Einheit
Nach 1 steht der Nominativ Singular, nach 2-4 steht der Nominativ Plural, nach 5 und mehr steht der Genitiv Plural.




If the system is the same as in Russian, in Slovak even numbers like 22, 23, 24 or 32, 33, 34 and so on would need nominative plural, and numbers like 15, 25, 36, 48, 59 and so on would need genitive plural. Maybe numbers like 11, 21, 31, 41 and so on would need nominative singular.


A "complicated" system like this, is it possible in translations of Scrabble3D now?


I OpenSource!
• Scrabble3D Download: Sourceforge.net | • Scrabble3D Help: Wiki | • Scrabble3D News: Twitter | • Scrabble3D Fanship: Facebook
• Scrabble3D in Italia: Sezione Scrabble3D sul Forum della Federazione Italiana Gioco Scrabble


Scotty Offline

Administrator


Posts: 3.595

Tue Nov 13, 2012 2:43 pm
#5 RE: Localization with Po-files alternatively to Ini Quote · reply

Zitat von Bussinchen im Beitrag #4
How about Russian/Slovak plurals?

Scrabble3D is able to talk in almost all tongues.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
  TPosixLocale=(
//nplurals=2; plural=n!=1;
af_ZA,bg_BG,ca_ES,de_AT,de_BE,de_CH,de_DE,de_LU,el_GR,en_AU,en_BW,en_CA,en_DK,
en_GB,en_HK,en_IE,en_IN,en_NZ,en_PH,en_SG,en_US,en_ZA,en_ZW,eo_EO,es_AR,es_BO,
es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,es_MX,es_NI,es_PA,es_PE,es_PR,
es_PY,es_SV,es_US,es_UY,es_VE,et_EE,eu_ES,da_DK,fi_FI,fo_FO,gl_ES,he_IL,hi_IN,
hu_HU,it_CH,it_IT,mr_IN,nl_BE,nl_NL,se_NO,nn_NO,no_NO,sq_AL,pt_PT,sv_FI,sv_SE,
ta_IN,te_IN,ur_PK,
//nplurals=1; plural=0;
fa_IR,id_ID,ka_GE,ms_MY,tg_TJ,th_TH,uz_UZ,vi_VN,zh_CN,zh_HK,zh_TW,
//nplurals=2; plural=n>1;
br_FR,fr_BE,fr_CA,fr_CH,fr_FR,fr_LU,mi_NZ,oc_FR,pt_BR,tr_TR,wa_BE,
//nplurals=2; plural=n==1 || n%10==1 ? 0 : 1;
mk_MK,
//nplurals=2; plural=n%10!=1 || n%100==11;
is_IS,
//nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;,
hr_HR,be_BY,bs_BA,ru_RU,ru_UA,sr_YU,uk_UA,
//nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
lt_LT,
//nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
pl_PL,
//nplurals=3; plural=n==1 ? 0 : n>=2 && n<=4 ? 1 : 2;
cs_CZ,sk_SK,
//nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n!=0 ? 1 : 2;'
lv_LV,
//nplurals=3; plural=n==1 ? 0 : n==0 || (n%100 > 0 && n%100 < 20) ? 1 : 2;
ro_RO,
//nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n!=8 && n!=11 ? 2 : 3;'
cy_GB,
//nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==3 ? 2 : 3;
kw_GB,
//nplurals=4; plural=n==1 ? 0 : n==0 || (n%100>1 && n%100<11) ? 1 : n%100>10 && n%100<20 ? 2 : 3;
mt_MT,
//nplurals=4; plural=n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0;
sl_SI,
//nplurals=4; plural=n==1 || n==11 ? 0 : n==2 || n==12 ? 1 : n>2 && n<20 ? 2 : 3;
gd_GB,
//nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4;'
ga_IE,
//nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;'
ar_AE,ar_BH,ar_DZ,ar_EG,ar_IN,ar_IQ,ar_JO,ar_KW,ar_LB,ar_LY,ar_MA,ar_OM,ar_QA,ar_SA,ar_SD,ar_SY,ar_TN,ar_YE);
 


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Bussinchen Online




Posts: 2

Tue Nov 13, 2012 4:56 pm
#6 RE: Localization with Po-files alternatively to Ini Quote · reply

But then what does this quotation mean ? -->

Zitat von Scotty im Beitrag #3
As a goody you can use numerals in pluralforms. To do so just replace %d (or %s) by a %w and translate rNumeralZero..rNumeralTwelve. All numbers between 0 and 12 will be replaced by the corresponding numeral.


What happens with 13, 14, 15...


I OpenSource!
• Scrabble3D Download: Sourceforge.net | • Scrabble3D Help: Wiki | • Scrabble3D News: Twitter | • Scrabble3D Fanship: Facebook
• Scrabble3D in Italia: Sezione Scrabble3D sul Forum della Federazione Italiana Gioco Scrabble


Scotty Offline

Administrator


Posts: 3.595

Tue Nov 13, 2012 5:11 pm
#7 RE: Localization with Po-files alternatively to Ini Quote · reply

Zitat von Bussinchen im Beitrag #6
What happens with 13, 14, 15...

Above 12 and below 0 the number itself will be issued.


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Bussinchen Online




Posts: 2

Tue Nov 13, 2012 5:23 pm
#8 RE: Localization with Po-files alternatively to Ini Quote · reply

I mean: Which plurals will be shown above 12 ?!


I OpenSource!
• Scrabble3D Download: Sourceforge.net | • Scrabble3D Help: Wiki | • Scrabble3D News: Twitter | • Scrabble3D Fanship: Facebook
• Scrabble3D in Italia: Sezione Scrabble3D sul Forum della Federazione Italiana Gioco Scrabble


Scotty Offline

Administrator


Posts: 3.595

Tue Nov 13, 2012 6:39 pm
#9 RE: Localization with Po-files alternatively to Ini Quote · reply

The plural form is chosen from the number depending on locale (and if translation is available). The use of numerals is independent from this function.


Download: Sourceforge.net | Help: Wiki | Discussion: Forum | News: Twitter | Fanship: Facebook


Bussinchen Online




Posts: 2

Tue Nov 13, 2012 8:12 pm
#10 RE: Localization with Po-files alternatively to Ini Quote · reply

Zitat von Scotty im Beitrag #9
The plural form is chosen from the number depending on locale (and if translation is available). The use of numerals is independent from this function.

I don't understand.

See here --> http://de.wikibooks.org/wiki/Russisch:_Anwendungen:_Zahlen --> Verwendung (in German.)


I OpenSource!
• Scrabble3D Download: Sourceforge.net | • Scrabble3D Help: Wiki | • Scrabble3D News: Twitter | • Scrabble3D Fanship: Facebook
• Scrabble3D in Italia: Sezione Scrabble3D sul Forum della Federazione Italiana Gioco Scrabble


linhart Offline




Posts: 2.463

Tue Nov 13, 2012 8:32 pm
#11 RE: Localization with Po-files alternatively to Ini Quote · reply

Zitat
The use of numerals is independent from this function.


I think I should explain this using German:

"numeral" here means "Zahlwort". Scotty means: Each number from 0 to 12 will be replaced by the corresponding Zahlwort, so e.g. "5" will be replaced by "five" if you use English, and by "fünf" if you use German, etc.

This has nothing to do with plural forms.


linhart Offline




Posts: 2.463

Tue Nov 13, 2012 8:39 pm
#12 RE: Localization with Po-files alternatively to Ini Quote · reply

Zitat
The plural form is chosen from the number depending on locale (and if translation is available).



Here "locale" means the table shown in posting Nr. 5
Localization with Po-files alternatively to Ini


Bussinchen Online




Posts: 2

Tue Nov 13, 2012 8:39 pm
#13 RE: Localization with Po-files alternatively to Ini Quote · reply

Yes, I know, my dear Linhart, thank you.

But how can correct Russian plurals (i.e. genitive singular and genitive plural) be associated to the right numerals? I don't understand how it works.


I OpenSource!
• Scrabble3D Download: Sourceforge.net | • Scrabble3D Help: Wiki | • Scrabble3D News: Twitter | • Scrabble3D Fanship: Facebook
• Scrabble3D in Italia: Sezione Scrabble3D sul Forum della Federazione Italiana Gioco Scrabble


Bussinchen Online




Posts: 2

Tue Nov 13, 2012 8:41 pm
#14 RE: Localization with Po-files alternatively to Ini Quote · reply

Never mind. I'm not a Russian translator, nor a Slovak translator, nor will I use po-files. Thank you.


I OpenSource!
• Scrabble3D Download: Sourceforge.net | • Scrabble3D Help: Wiki | • Scrabble3D News: Twitter | • Scrabble3D Fanship: Facebook
• Scrabble3D in Italia: Sezione Scrabble3D sul Forum della Federazione Italiana Gioco Scrabble


linhart Offline




Posts: 2.463

Tue Nov 13, 2012 8:42 pm
#15 RE: Localization with Po-files alternatively to Ini Quote · reply

Zitat
But how can correct Russian plurals (i.e. genitive singular and genitive plural) be associated to the right numerals? I don't understand how it works.


I don't either.

I just wanted to clarify possible misunderstandings.


pages 1 | 2
 Jump  
disconnected Scrabble3D Chat Members online 1
Xobor Einfach ein eigenes Forum erstellen