Inflection aware messages

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Posts: 352
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia

Inflection aware messages

Postby Ignatus » Sat Mar 28, 2020 10:41 pm

This is not a gameplay related thread, we have many more important things to improve, but if we had better messages language, it would surely please us.

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.

Posts: 18
Joined: Thu Jul 11, 2019 2:05 pm

Re: Inflection aware messages

Postby jwrober » Mon Mar 30, 2020 6:30 pm

I wonder how other OSS projects handle i18n? Freeciv could piggyback on those efforts. Is there some kind of library we could use?

Posts: 344
Joined: Mon Jul 02, 2018 1:49 pm

Re: Inflection aware messages

Postby Wahazar » Mon Mar 30, 2020 6:51 pm

jwrober wrote:I wonder how other OSS projects handle i18n? Freeciv could piggyback on those efforts. Is there some kind of library we could use?

I like system implemented in OpenTTD: ... usage.html
Everybody can work on given translation, which is automatically merged into main project.
Translator support genders, cases, plural forms etc: ... rings.html
Augmented2 ruleset/modpack for freeciv2.6: viewtopic.php?f=11&t=91047