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

show the language file location of a string element (for debugging / developing / translation purposes)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • 2.0
    • 1.9
    • Language
    • None
    • MOODLE_19_STABLE
    • MOODLE_20_STABLE
    • Easy

      a little $CFG->showstrings option to display the location of the translation file
      that is responsible for that element. and display it inside brackets adjacent to it, on the screen.
      (i use $CFG->showstrings = ture; inside config.php to activate this feature )

      very very helpful for new comers to the world of Moodle translation.

      i bet, you should have seen this one coming

      here is the new get_string_from_file() function that should replace the one inside "lib/moodlelib.php"
      ( it is actually, a tiny change. i guess )

      function get_string_from_file($identifier, $langfile, $destination) {

      global $CFG;
      static $strings; // Keep the strings cached in memory.

      if (empty($strings[$langfile]))

      { $string = array(); include ($langfile); $strings[$langfile] = $string; }

      else

      { $string = &$strings[$langfile]; }

      if (!isset ($string[$identifier]))

      { return false; }

      if ($CFG->showstrings)

      { //echo "<div style=\"direction:ltr;\">'$identifier'='$string[$identifier]' >> '".ltrim($langfile,"$CFG->dataroot/lang/")."'</div>"; return $destination .'= sprintf("'.$string[$identifier] .'('. ltrim($langfile,"$CFG->dataroot/lang/").')");'; }

      return $destination .'= sprintf("'. $string[$identifier] .'");';
      }

            mudrd8mz David Mudrák (@mudrd8mz)
            nadavkav Nadav Kavalerchik
            Koen Roggemans Koen Roggemans
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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