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

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.9.6, 3.1
    • None
    • HTML and CSS

    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

              Unassigned Unassigned
              markn Mark Nelson
              Ryan Wyllie Ryan Wyllie
              Amy Groshek, David Scotson, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: