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
After February 6, this site will no longer have Facebook, Twitter, or OpenID sign-in options. Read our announcement about social media SSO support in 2.8 for more info.

Make sure you have a current, valid email address set in your profile and set a password so you can login without it. If you get locked out after that time, you can choose "Forgot Password" to fix it as long as a valid email is on your account.

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.