Currently, all things and figures in Freeciv that should be named in messages have only one string that is used as their name. Nations have two strings, name and adjective, but they are mostly translated as the same, probably because no one can get the idea when each one is used (I judge by Russian translation). This sometimes might lead to broken language even in English; if we have a message "Your %s has not enough movepoints left to perform %s now", the first %s is good for "Spy" but requires "have" verb for "Archers", and _PL() function can't help here. Also, we would like at the end "establish trade route" better than "perform Establish Trade Route". There are gender languages, as French, where we might sometimes mind if our Spy is female or male. CivIV XML files have gender and number specifications for each translation of each unit name. But there are case languages, say Russian, where you must inflect nouns and adjectives depending on their role in the sentence and the words they are related with.
How message writers get around now: in Russian, all messages mentioning units and nations do it after words, correspondingly, "soyedineniye" and "narod" used in the appropriate form in the message. Using the nominative case for the noun in this context is more or less plausible Russian but very far from excellent.
I don't know any particular gettext extension that can cope with this problem. I can only imagine how it would look. Say, in the message table we have
"Your <%s [has]> not enough movepoints left to <[?p:v=|perform] %s> now"
that is translated to Russian as
"У <[c=g][ваш] %s> недостаточно очков движения, чтобы сейчас <[?p:v=|выполнить[c=a] ]%s>"
For the units and actions, we have in English
"Sp[y][g=f]" ;gender for "he/she/they" in some msgs
"establish[ING] trade route<[?Nroutes:sg|pl=[N=Nroutes]|[N=sg]][S]>[p=v]"
and in Russian
"установ[ить] <[?Nroutes:sg|pl=[N=Nroutes]|[N=sg]]торгов[ый] [путь]>[p=v]"
The flexion definitions would contain for English langpack
Code: Select all
and for Russian langpack
Code: Select all
A function that has flexion tables preloaded from a langpack would get the flexible strings assembled with sprintf() and interpret the code (e.g. [variable to substitute], [variable=value to set], [!variable:value if not set], <zone of local variables>...). The syntax may be as simple as it's shown and suitable for virtually any language, all differences are in the conventions of what variables serve for what purpose in a specific langpack (e.g. "c" codes case, "g" for gender, "t" for tence...). The problem is that translators don't swarm around, and using system like this (if nobody can find a database or write a script to auto-import language flexioned dictionary from Wiktionary) requires loads of time and at least basic linguistic education.