Plural phrases

  • Translating Woltlab properly requires additional modifications of core libraries,templates when it comes to plural forms in variety of languages. In the future that should not be the case because modifying core files and templates cuts us off the automatic updates. With modifications to the libraries it has to be updated manually which is quite tedious.

    In English pluralisation is quite simple, you just normally add an 's' at the end if there's multiple units of something but it might be way more complex when it comes to others languages. I have no idea how it is in German language and how Woltlab deals with it but I assume there aren't any issues.


    For example, take the phrase 'x registered user(s)' and translate it to the Lithuanian language. The phrase will look quite differently depending on the quantity of the noun and even the word that describes the noun changes alongside with the numbers:


    If number is or ends in 1 the phrase should be "x registruotas vartotojas"

    If number is or ends in 0,11,12,13,14,15,16,17,18,19 the phrase should be "x registruotų vartotojų"

    If number is or ends in 2,3,4,5,6,7,8,9 the phrase should be "x registruoti vartotojai"


    Normally I have a custom function that parses the translation strings alongside the php variables but as I mentioned before I rather not modify the system to achieve that. And if there is a way to achieve that without writing million if blocks in the templates, let me know. I might have missed something as there little to no documentation.:/


    I've used IPS community suite for a while and they have a nifty regex based solution that can be applied to any language (please read to have a general idea): https://invisioncommunity.com/…_326/plural-phrases-r121/


    If Woltlab had something along those lines it would be just perfect.;)

  • Hi,


    Take a look at this thread. You can also check the german language files (de.xml). You can see there how to deal with plurals (no need to understand German).


    Regards.

    My styles and plugins in the Plugin-Store.

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