Loco Translate
[resolved] wrong plural expression in saved PO file (5 posts)

  1. mitk0
    Posted 2 years ago #

    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,


  2. timwhitlock
    Plugin Author

    Posted 2 years ago #

    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


  3. timwhitlock
    Plugin Author

    Posted 2 years ago #

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

  4. mitk0
    Posted 2 years ago #

    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.

  5. timwhitlock
    Plugin Author

    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Loco Translate
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic