Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to translate gendered pronouns in Qt's QTranslator

I'm looking at an open source QT4 game (http://cockatrice.de), and it uses QTranslator for internationalization. However, every phrase that refers to the player uses a masculine pronoun ("his hand", "his deck", "he does such-and-such", etc.)

My first thought for fixing this would be to just replace every instance of "his" or "he" with a variable that is set to the correct gendered pronoun, but I don't know how this would affect the translations. But for translating/internationalization, this might break, especially if the pronoun's gender affects the rest of the phrase.

Has anyone else worked with this sort of problem before? Is it possible to separate out the pronoun and the phrase in at least the easy languages (like English, in this case)? will the translation file have to include a copy of each phrase for each gendered pronoun? (doubling, at least, the size of the translation file)?

some sample code from how it's currently set up:

calling source:

case CaseNominative: return hisOwn ? tr("his hand", "nominative") : tr("%1's hand", "nominative").arg(ownerName);
case CaseGenitive: return hisOwn ? tr("of his hand", "genitive") : tr("of %1's hand", "genitive").arg(ownerName);
case CaseAccusative: return hisOwn ? tr("his hand", "accusative") : tr("%1's hand", "accusative").arg(ownerName);

english translation file:

  <message>
    <location filename="../src/cardzone.cpp" line="51"/>
    <source>his hand</source>
    <comment>nominative</comment>
    <translation type="unfinished"></translation>
</message>
like image 748
YenTheFirst Avatar asked Mar 16 '11 01:03

YenTheFirst


1 Answers

maybe split:

tr("his hand")

into:

tr("his").append("hand")

and then translate "his", "her", "its", ... seperately. but there will be some problems in languages like italian, where there are personal suffixes...

alternative:

tr("his hand");
tr("her hand");
//...

and translate them all.

EDIT: the second alternative shown is also used in many other games (like oolite, ...), because it's the only way to be sure there will not be problems (like suffixes instead of prefixes...) in other languages.

btw what would Konami or Nintendo say when they'll realize you are creating an open source Yu-Gi-Oh!/Pokemon playing field? nobody will buy their cards :-P

like image 135
nonchip Avatar answered Sep 20 '22 04:09

nonchip