-
New Feature
-
Resolution: Won't Fix
-
Minor
-
None
-
2.0.2
-
None
-
MOODLE_20_STABLE
-
Moderate
Translation of single and plural numbers to different language is complex problem, because in other languages are used different rules than in English.
Posible solution is to use special function for it and to store it in language pack. Call to this function can be defined in langueage string as arg1, arg2, ....
english example
string: You have
,message,messages}}.
function:
function plural () {
if (func_get_arg (1) == 1)
}
russian example (other grammar rules)
string: У Вас непрочитано {a} {{{a},сообщение,сообщения,сообщений}}.
function:
function plural () {
if (func_get_arg (1) == 1) { return func_get_arg (2); }
else if (func_get_arg (1) == 2 or func_get_arg (1) == 3)
{ return func_get_arg (3); }else
{ return func_get_arg (4); }}
Benefits: Adding such function now can improve translation quality for some languages in future. It's not required to change anything in English langpack. Langpack mantainers could write such function for their languages and use this substitution whenewer needs.
- has been marked as being related by
-
MDL-12433 get_string support for plurals and some other grammar via simple conditional expressions
-
- Closed
-