Lack of interest Pluralization

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

kick

Well-known member
It would be cool if XenForo in phrases allowed to use declensions. It's remarkable how the laravel framework does it.
Pluralization
Pluralization is a complex problem, as different languages have a variety of complex rules for pluralization. By using a "pipe" character, you may distinguish singular and plural forms of a string:
'apples' => 'There is one apple|There are many apples',
You may even create more complex pluralization rules which specify translation strings for multiple number ranges:
'apples' => '{0} There are none|[1,19] There are some|[20,*] There are many',
After defining a translation string that has pluralization options, you may use the trans_choicefunction to retrieve the line for a given "count". In this example, since the count is greater than one, the plural form of the translation string is returned:
echo trans_choice('messages.apples', 10);
You may also define placeholder attributes in pluralization strings. These placeholders may be replaced by passing an array as the third argument to the trans_choice function:
'minutes_ago' => '{1} :value minute ago|[2,*] :value minutes ago',
echo trans_choice('time.minutes_ago', 5, ['value' => 5]);
If you would like to display the integer value that was passed to the trans_choice function, you may use the :count placeholder:
'apples' => '{0} There are none|{1} There is one|[2,*] There are :count',
This allows you to get rid of phrases in the plural. Sometimes this is simply necessary and creating phrases for the sake of one and the same comes out somehow silly. + This will help for features of many languages.
 
Upvote 6
This suggestion has been closed. Votes are no longer accepted.
The Laravel approach is nice, but it doesn't actually solve the problem as far as I can see, as it doesn't (appear) to allow rules that apply (for example) to all numbers that end in the digit 2 (2, 12, 22, 32... n2) with a separate rule for all numbers that end in 3 (3, 13, 23... n3) and other rules that apply to infinitely continuing rule-based sequences.

You can get the full run-down of just how complex pluralisation really is here:

🤕
 
it covers more than 90% of typical phrases and in some phrases it is possible to choose more suitable endings and set certain rules related to 2.
Each translation is a list of separated strings. Each string belongs to an interval that is denoted in the ISO 31-11 form. A few examples of intervals:
{0} = 0 {1,2,3} = 1, 2, 3 [0, 3] = 0, 1, 2, 3] 0, 3] = 1, 2, 3] 0, 3 [= 1, 2 [-2, Inf] = -2, -1, 0, 1, 2, ..., n [-Inf, Inf] = -n, ..., -1, 0, 1, ..., n
when implementing this standard, a lot is possible and the chic potential can reveal and help really in a good translation in different languages. This will solve many problems with grammar and more. Thank you @Kier that you are interested in this and hope that it will be implemented soon.
 
Back
Top Bottom