Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27221

Multilanguage substitution for single/plural

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 2.0.2
    • Language
    • 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

      {a} unread {{{a}

      ,message,messages}}.
      function:
      function plural () {
      if (func_get_arg (1) == 1)

      { return func_get_arg (2); } else { return func_get_arg (3); }
      }

      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.

            Unassigned Unassigned
            vadimon Vadim Dvorovenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.