Support » Plugin: Loco Translate » How to Translate with Plural

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tim W

    (@timwhitlock)

    Hi there. Thanks for this.

    It seems that WordPress and Unicode disagree on the plural forms for Indonesian.

    According to Unicode CLDR Indonesian has no plualization (having just a single form “other” like Chinese/Japanese). These are the rules that Loco Translate uses.

    I see now though, that the WordPress core translations for Indonesian use germanic plurals (one,other). Is this what you know to be correct?

    There is currently no fix for this, but if I can be sure that [one,other] is correct for Indonesian I’ll change this in the next version of the plugin.

    In the mean time I’ll add a filter into the development version so you can modify/customize the plurals using some code. I’ll post back when I’ve done that.

    Plugin Author Tim W

    (@timwhitlock)

    The development branch (2.1.0-dev) has a new filter (loco_locale_plurals) that allows you to change plural rules by manipulating the raw locale data.

    The following code will alter Indonesian to use the same plurals as you’ll find in the WordPress core files. (This rule is the same as French, for example).

    function fix_indonesian_plurals( array $data, Loco_Locale $locale ){
        if( 'id' === $locale->lang ){
            $data[0] = 'n > 1';
            $data[1] = array('one','other');
        }
        return $data;
    }
    add_filter( 'loco_locale_plurals', 'fix_indonesian_plurals', 10, 2 );
    

    I may fix the built-in rules for Indonesian, but first I need to know for certain what they should be.

    Yes, Indonesian same with German plurals (one, other)

    Plugin Author Tim W

    (@timwhitlock)

    German is like English (n != 1) whereas WordPress (GlotPress) uses (n > 1) for Indonesian (as with French).

    The difference in the equation will affect how your translations are displayed for different quantities. In English you’ll see the “one” form for only 1 of something (like “1 Comment”) but in French you’ll see it for 0 and 1.

    You see my problem of implementing rules that the authorities can’t seem to agree upon?

    Plugin Author Tim W

    (@timwhitlock)

    Wondering if @ekajogja can help here and confirm that the GlotPress plural rules are correct and Unicode CLDR is wrong.

    Unicode CLDR is correct.

    The tab should be labeled plural instead of semua bidang which translates to all fields (You meant we should translate both obviously different fields into one field?).

    More helpful title would be: plural (ignore single).

    • This reply was modified 1 year, 1 month ago by  Eka Y Saputra.
    Plugin Author Tim W

    (@timwhitlock)

    Thanks for the clarification. I shall leave the plugin data as it is.

    Regarding the label: the source string is All forms. I won’t change the English, but the translation is there for anyone to improve it in their language.

    I’m marking this as resolved because I’ve added a filter to allow plural rule customization.

    I’ve also made a note to fix the editor to use plural rules defined by PO files if they differ from the internal rules.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to Translate with Plural’ is closed to new replies.