You are here

function get_string in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle_support.php \get_string()

Moodle localized string function from moodle/lib/moodlelib.php reimplemented hackedly for within the Drupal Quiz module e.g. get_string("wronggrade", "quiz", $nLineCounter).' '.get_string("fractionsnomax", "quiz", $maxfraction);

Parameters

string $identifier The key identifier for the localized string:

string $module The module where the key identifier is stored, usually expressed as the filename in the language pack without the .php on the end but can also be written as mod/forum or grade/export/xls. If none is specified then moodle.php is used.:

mixed $a An object, string or number that can be used: within translation strings

array $extralocations An array of strings with other locations to look for string files:

Return value

string The localized string.

33 calls to get_string()
default_export_filename in includes/moodle/lib/questionlib.php
Create default export filename
get_grade_options in includes/moodle/lib/questionlib.php
Returns list of 'allowed' grades for grade selection formatted suitably for dropdown box function
get_import_export_formats in includes/moodle/lib/questionlib.php
Get list of available import or export formats
print_error in includes/moodle_support.php
qformat_coursetestmanager::importprocess in includes/moodle/question/format/coursetestmanager/format.php
Process the file This method should not normally be overidden

... See full list

File

includes/moodle_support.php, line 84

Code

function get_string($identifier, $module = '', $a = NULL, $extralocations = NULL) {
  assert($module == 'quiz');

  /// if $a happens to have % in it, double it so sprintf() doesn't break
  if ($a) {
    $a = clean_getstring_data($a);
  }
  global $CFG;
  $langfile = "{$CFG->dirroot}/lang/en_utf8/{$module}.php";
  if (file_exists($langfile)) {
    if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
      if (eval($result) === FALSE) {
        trigger_error('Lang error: ' . $identifier . ':' . $langfile, E_USER_NOTICE);
      }
      return $resultstring;
    }
  }

  // last resort
  return '[[' . $identifier . ']]';
}