About PluralTranslate()

Could someone tell me how to localize the following strings?
\applications\vanilla\views\discussions\helper_functions.php
printf(PluralTranslate($Discussion->CountComments, '%s comment html', '%s comments html', '%s comment', '%s comments'), BigPlural($Discussion->CountComments, '%s comment'));
my language pack:
$Definition['%s comment'] = '%s XXXX'; $Definition['%s comments'] = '%s XXXX';
It didn't work.
Tagged:
0
Best Answer
-
Kasper Vanilla Staff
Here's the function:
function PluralTranslate($Number, $Singular, $Plural, $SingularDefault = FALSE, $PluralDefault = FALSE) { if ($Number == 1) return T($Singular, $SingularDefault); else return T($Plural, $PluralDefault); }
Meaning that your locale definitions should look like this:
$Definition['%s comment html'] = '%s XXXX'; $Definition['%s comments html'] = '%s XXXX';
Why is that? Because the
$Singular
and$Plural
variables are the ones being used as identifiers in thePluralTranslate
function (e.g.T($Singular, $SingularDefault
).Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
1
Answers
Here's the function:
Meaning that your locale definitions should look like this:
Why is that? Because the
$Singular
and$Plural
variables are the ones being used as identifiers in thePluralTranslate
function (e.g.T($Singular, $SingularDefault
).Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
@kasperisager Solved! Thanks for your help.