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

Multilanguage substitution for single/plural

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              vadimon Vadim Dvorovenko
              Participants:
              Component watchers:
              David Mudrák (@mudrd8mz), Helen Foster, Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: