• Resolved Addono

    (@addono)


    Can somebody please explain why the first one works (prints “5 berichten”), but the second one does not (prints “5 messages”)?

    $amount = 5;
        printf(__("%s messages", "plugin-name"), $amount );
        printf(_n("%s message", "%s messages", $amount, "plugin-name"), $amount );

    I assume it’s already asked, I have searched for a while, but couldn’t find anything.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter Addono

    (@addono)

    Found the problem and solution,

    The plural string (second parameter of _n()) doesn’t expect the same notation in the .po file, but a plural specific one.

    Changing:

    msgid "%s message"
    msgstr "%s bericht"
    
    msgid "%s messages"
    msgstr "%s berichten"

    to this:

    msgid "%s message"
    msgid_plural "%s messages"
    msgstr[0] "%s bericht"
    msgstr[1] "%s berichten"

    Worked

Viewing 1 replies (of 1 total)
  • The topic ‘Unexpected _n() behaviour’ is closed to new replies.