Translation: problem with plural in my language

  • I need some help with translation to polish language on which I'm currently working ;)


    In some lines there are strings which are different based on singular/plural version of words.



    One line as example


    Code
    1. <item name="wbb.acp.bulkProcessing.thread.success"><![CDATA[The chosen action affected {#$affectedThreads} thread{if $affectedThreads != 1}s{/if}.{if $affectedThreads > 0}<br />Please make sure to <a href="{link controller='RebuildData'}{/link}">“Verify Integrity”</a> afterwards.{/if}]]></item>

    As You can see here:
    - if items count is 1 - word "thread" is used
    - if there are more than 1 item - "s" letter is added to word, so word is "threads"


    At my language there more possible states:
    - if 1 - then "wątek"
    - if 2-4 then "wątki"
    - if 5-20 then "wątków"
    - if 22-24, 32-34, 42-44 etc. then "wątki"
    - if 25-31, 35-41, 45-51 etc. then "wątków"


    As You can see this is pretty complicated at my language and I have no idea how to turn this correctly into code :( Anybody got some idea?


    Currently I see similar situation at multiple lines, eg.: 105, 188, 289, 339, 361, 540, 818

  • Code
    1. {if $affectedThreads == 1}wątek{else}{if ($affectedThreads > 4 && $affectedThreads < 21) || (($affectedThreads % 10 == 1 || $affectedThreads % 10 == 5 || $affectedThreads % 10 == 6 || $affectedThreads % 10 == 7 || $affectedThreads % 10 == 8 || $affectedThreads % 10 == 9 || $affectedThreads % 10 == 0) && $affectedThreads > 4)}wątków{else}wątki{/if}{/if}

    Does someone have an idea how to improve?
    Sure, he could assign an array with [0, 1, 5, 6, 7, 8, 9] in it and proove with in_array instead of ($affectedThreads % 10 == 1 || $affectedThreads % 10 == 5 || $affectedThreads % 10 == 6 || $affectedThreads % 10 == 7 || $affectedThreads % 10 == 8 || $affectedThreads % 10 == 9 || $affectedThreads % 10 == 0).
    But that's still pretty ugly.

  • This thread could be useful for you

    My styles and plugins in the Plugin-Store.

    ♪Quiero robarle los minutos a las horas pa' que mis padres nunca se me pongan viejos...♫