Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

About PluralTranslate()

OniaOnia New
edited February 2013 in Localization

Could someone tell me how to localize the following strings?


               '%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.


  • KasperKasper Scholar of the Bits Copenhagen Vanilla Staff

    Here's the function:

    function PluralTranslate($Number, $Singular, $Plural, $SingularDefault = FALSE, $PluralDefault = FALSE) {
        if ($Number == 1)
            return T($Singular, $SingularDefault);
            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 the PluralTranslate 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.

Sign In or Register to comment.