flare-game icon indicating copy to clipboard operation
flare-game copied to clipboard

Declension in translation

Open Zaraka opened this issue 11 years ago • 20 comments

Hi, I would like to translate fantasycore and alpha_demo into Czech language, the problem with czech is, it has Declension (http://en.wikipedia.org/wiki/Declension), So I need to write different text for Female/Male Heroes, and change text for npc when they adress hero. something like this would be perfect

#: ../npcs/martigan.txt:103
msgid "I've defeated the Reanimated Skeleton."
msgstr_male "Porazil jsem Znovuzrozeného Kostlivce"
msgstr_female "Porazila jsem Znouzrozeného Kostlivce"

Currently I'm writting everything in male form, but I don't think that I will be able translate everything to 30.3

Zaraka avatar Mar 27 '13 14:03 Zaraka

Is it possible to change the sentence to a neutral form?

E.g. "The Reanimated Skeleton has been defeated" or "The Reanimated Skeleton is now dead."

clintbellanger avatar Mar 27 '13 14:03 clintbellanger

In this case yes, but elsewhere it would be like raping little children. Sometimes when you make neutral form in Czech, it's like speaking with robot.

Zaraka avatar Mar 27 '13 15:03 Zaraka

I see. I'm sure it's a similar issue with other languages. We'll take a look at this for v0.19.

If anyone wants to post similar examples here, that will give us test cases.

clintbellanger avatar Mar 27 '13 15:03 clintbellanger

We may want to graduate from my "gettext-lite" implementation to full gettext support. We can internalize the library so there aren't any additional dependencies. It would take a thorough overhaul of all translated strings, though.

pennomi avatar Mar 27 '13 19:03 pennomi

We may just decide we can live with simple translations. It depends on how many cases like this exist.

For many of the strings in the game a simple 1:1 translation is fine. In this specific case there's an external variable that changes: the gender of the hero. Luckily our hero doesn't talk much, which is in line with the action RPG genre that Flare is targeting. We could have the hero speak less often and rarely in first person.

Compare to more story-driven, character-development games like Polymorphable. The hero has a fixed identity and such a translation issue doesn't exist.

If the current system works on 99% of the text, and the remaining 1% becomes awkward, I'll live. But if we discover it's more like 80/20 we can seriously consider a gettext library.

clintbellanger avatar Mar 27 '13 19:03 clintbellanger

Well, declension is in every slavic language, but there may be more exceptions in other languages

I will finish my translation and tell you how big this problem is.

Zaraka avatar Mar 27 '13 21:03 Zaraka

Notice it's also a problem in all romance languages, just not to the same extent, I believe.

pennomi avatar Mar 27 '13 21:03 pennomi

Let's collect examples. Languages are more complex than we think.

Here's an issue sent in by Pavel, related to translating in Polish:

I've a little problem. I'll show you how "Gold pieces" looks in Polish with different numbers:

1 Sztuka złota
2-4 Sztuki złota (the same goes for 22-24, 32-34... xx2-xx4)
5-9 Sztuk złota

He's opted to abbreviate to avoid the issue: "Szt. złota".

clintbellanger avatar Mar 27 '13 21:03 clintbellanger

Side note, we don't deal with some of these issues even in English. E.g. a stack of health potions on the ground will show as "5 Health Potion" instead of the correct "5 Health Potions". Which I am completely fine with.

In this particular case I wonder if we can make "[item number] [item name]" configurable. That wouldn't work so much with gettext which would look like "%s %s". But it'd be nice to allow formatting those. E.g. "5 Health Potion" can be "Health Potion x5" or "Health Potion [5]". This wouldn't be high priority, and may be just too low level to matter.

clintbellanger avatar Mar 27 '13 21:03 clintbellanger

@pennomi Yep, sometimes the adjectives have to be declined according to the gender. Also some nouns have to be declined according to gender as well. The latter is also true for German.

cjsthompson avatar Mar 28 '13 00:03 cjsthompson

Hum it's even true for English now that I think of it.

cjsthompson avatar Mar 28 '13 00:03 cjsthompson

@clintbellanger I agree changing pickup text will solve plural number problem (I have same problem as Pavel). But what to do with male/female?

Zaraka avatar Apr 01 '13 06:04 Zaraka

I hope someday you'll change your mind on incorporating gettext into Flare. The limitations in self-made i18n engines force translators to mangle words and only result in worse playing experience for non-English speakers.

Plural forms is what gettext is good at. It has a function specifically for that case - ngettext, which chooses correct plural form depending on a number. There are languages that have 4 (!) plural forms (e.g. KDE project uses 4 plural forms for Russian and Slovenian).

Gender forms can be also handled with gettext using contexts. There is another function for doing that - pgettext.

SBasalaev avatar Apr 10 '13 18:04 SBasalaev

@SBasalaev I think you're definitely right. It may introduce a lot of complexity into the translation process, but perhaps this is the right time to add the proper professional polish. My guess is that this issue will continue to be a thorn in our side until it eventually gets done.

Unfortunately, I doubt I am qualified to put my code where my mouth is, since I speak only English (and a very modest bit of Spanish).

pennomi avatar Apr 10 '13 18:04 pennomi

We certainly are considering it. Some considerations:

  • Before we add it I want to make sure it's worth it -- games of this entire genre (Action RPG) use comparatively little text.
  • If we add an external gettext lib it has to be as widely ported as SDL 1.2 and work on platforms where Flare currently works.

clintbellanger avatar Apr 10 '13 18:04 clintbellanger

Does the full gettext spec solve the male/female speaker declination issue? The one Zaraka mentions as an example in this original post.

clintbellanger avatar Apr 16 '13 17:04 clintbellanger

This may be solved using contexts. That is, generating for male and female hero two separate strings. This would look like:

msgctxt "male"
msgid "I've defeated the Reanimated Skeleton."
msgstr "Porazil jsem Znovuzrozeného Kostlivce"

msgctxt "female"
msgid "I've defeated the Reanimated Skeleton."
msgstr "Porazila jsem Znouzrozeného Kostlivce"

The downside of supporting original gettext may be that it uses binary files and expects certain directory structure so it can become a little harder for modders (everything else is a plain text). So, probably, hacking existing solution to support more gettext features is not a bad idea either.

SBasalaev avatar Apr 17 '13 04:04 SBasalaev

Is this issue still considered? I'm translating Flare to Polish and in some cases I hale really hard time to make it work for males and females?

Pawonashi avatar Apr 06 '16 13:04 Pawonashi

I also think that using a full gettext library is of benefit. I don't know whether anyone can tell what can happen in a language and what not. This is a very hard task that can be solved only with computer linguistics and long research. I don't know the source, but I think, implementing a wrapper library should be easy. Actually I did this the other way around in order to use wxWidgets' gettext implementation with code that has been designed to be used with the original gettext library.

Regarding the male/female thing: gettext returns the original string if it doesn't find a translation, so you could use something like

    char * s,t;
    s = "female|something";
    if ((t = gettext(s)) == s) {
        t = gettext("something");
    }
    print(t);

This would avoid the necessity to translate all declined forms if they don't differ in a certain language. For more information take a look at the gettext sources (in particular pgettext).

keinstein avatar Sep 02 '16 21:09 keinstein

I am also in favor of using gettext. We are using both pgettext and ngettext in another project that I'm involved in (Widelands) and it works very well. It's another GPL project, so please feel free to take any code from us that you need.

gunchleoc avatar Sep 18 '16 07:09 gunchleoc