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

Add ability to pass variables for the identifier and component in the string mustache helper

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.9.6, 3.1
    • Fix Version/s: None
    • Component/s: HTML and CSS
    • Labels:

      Description

      Currently if I try -

      {{#str}}{{country}}, countries{{/str}}

      It fails because we are literally passing

      {{country}}

      to get_string() which then gets cleaned and ends up with get_string() throwing an exception about an empty identifier. In my use case I get a user record from the DB and want to translate the country, so 'AU' becomes 'Australia'. We currently do this in lib/myprofilelib.php by doing get_string($user->country, 'countries'). This will not work in templates.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              markn Mark Nelson
              Peer reviewer:
              Ryan Wyllie
              Participants:
              Component watchers:
              Amy Groshek, David Scotson, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: