HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Czech plural forms and gender suffix

edited August 2012 in Localization

Hi,

I've been trying to translate vanilla forum for a while and I have 2 issues:

1. Czech language has 3 plural forms, to fix that I wrote this function (/forum/locales/cs-CZ/definitions.php):

if(!function_exists('Plural')){
    function Plural($Number, $Singular, $Plural) {
    $Result = null;
    if ($Number == 1) {
        $Result = Gdn::Translate($Singular, $Singular);
    } else if ($Number < 5) {
        $Result = Gdn::Translate('2'.$Plural, $Plural);
    } else {
        $Result = Gdn::Translate('5'.$Plural, $Plural);
    }
    return $Result;
    }   
}

and inserted these definitions in the same file:

$Definition['%s comment'] = '%s komentář';
$Definition['2%s comments'] = '%s komentáře';
$Definition['5%s comments'] = '%s komentářů';

Looks good, now I see "1 komentář", "2 komentáře", "10 komentářů" in vanilla.
Then I tried doing the same with %s discussion. So I just wrote a few definitions:

$Definition['%s discussion'] = '%s diskuzi';
$Definition['2%s discussions'] = '%s diskuze';
$Definition['5%s discussions'] = '%s diskuzí';

And the result? Instead of "1 diskuzi", "2 diskuze", "10 diskuzí" I'm getting "%s diskuzi", "%s diskuze" in vanilla (with that "%s" instead of a number). The same problem applies for other strings that have more plural forms, but not for the "comment" plurals. I don't know what the "Gdn::Translate" function exactly does (I haven't found any documentation) so it's almost impossible to fix it (for me).

2. I've read that the variable "%9$s" represents gender suffix. I added these deffinitions:

$Definition['GenderSuffix.First.f'] = 'a';
$Definition['GenderSuffix.First.m'] = '';
$Definition['GenderSuffix.Third.f'] = 'a';
$Definition['GenderSuffix.Third.m'] = '';

and tried to edit one line from this:

$Definition['%1$s sent you a %8$s.'] = '%1$s poslal(a) %8$s';

to this:

$Definition['%1$s sent you a %8$s.'] = '%1$s poslal%9$s %8$s';

but that doesn't work.

Vanilla version: 2.0.18.4

Sign In or Register to comment.