Support » Plugin: Loco Translate » wrong plural expression in saved PO file

  • Resolved mitk0


    I believe I found a bug in Loco Translate 1.2.1:

    while combining the locales the $raw array first contains:

    0:<locale name>,1:<no. of plurals>,2:<idx of plural expression>

    plural expression is retrieved with wrong index ($raw[1] instead of $raw[2])

    corrected code ($raw[1] replaced with $raw[2]) in file lib/loco-locales.php:

    $locale = new LocoLocale( $lc, $cc );
            if( isset($locales[$lc]) ){
                if( ! $cc ){
                    $cc = key( $locales[$lc] );
                if( isset($locales[$lc][$cc]) ){
                    $raw = $locales[$lc][$cc];
                    $raw[2] = $plurals[ $raw[2] ];
                    $locale->__import( $lc, $cc, $raw );
            return $locale;

    best regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author timwhitlock


    You’re absolutely right. thanks for spotting this.

    I’ve made a fix in the current development version, which will become 1.2.2.

    I’d appreciate if you could check this works for you, then I’ll publish it to the live release ASAP


    Plugin Author timwhitlock


    I’ve published this to the current stable version, it seems fine.

    I’ve tested the trunk – it’s OK.

    I had an issue though with the plural expression for Slovenian:

    WP core uses (“old style”) expression:
    n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3

    Loco uses the nu style:
    n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0

    Could you perhaps make this configurable?
    Make another settings tab with exposed locales?

    .. just a wish
    It’s a great plugin anyway.

    Plugin Author timwhitlock


    Interesting to know, thanks.

    I’ve got a long list of improvements to make and making my rather weak locale selection screen better and more configurable is definitely on the list. I can’t promise a timeframe though.

    If you use the full Loco app all locales ARE fully configurable. However, to use the full app with WordPress you’ll have to pull down your MO files manually. It’s not synced to the WordPress plugin yet, although it will be eventually!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wrong plural expression in saved PO file’ is closed to new replies.