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

Improve Str.get_strings API

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.5, 3.5.2
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE

      Description

      The strings = Str.get_strings(...) for fetching mulitple lang strings in one Ajax call is good for performance. However, at the moment, the API then involves accessing the loaded strings as strings[0], strings[1], etc. which is horrible.

      The strings Array returned should have a get_string function added, so you can do strings.get_string(key, component, param) (as a syncronous function call) to access the loaded strings in an easily readable way, with insertion of values in to placeholders in the familiar fashion.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              timhunt Tim Hunt
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: