]> git.mjollnir.org Git - moodle.git/commitdiff
Additional paramter for get_string() that allows the calling code to
authormoodler <moodler>
Mon, 2 Oct 2006 15:08:25 +0000 (15:08 +0000)
committermoodler <moodler>
Mon, 2 Oct 2006 15:08:25 +0000 (15:08 +0000)
specify extra locations for strings

lib/moodlelib.php

index 7de98adeb3c3f3959035b7c25b2c513d6149f64f..944916a5493945d21da876e489a915e53e92b62b 100644 (file)
@@ -4213,9 +4213,10 @@ or
  * @param string $module The module where the key identifier is stored. If none is specified then moodle.php is used.
  * @param mixed $a An object, string or number that can be used
  * within translation strings
+ * @param array $extralocations An array of strings with other locations to look for string files
  * @return string The localized string.
  */
-function get_string($identifier, $module='', $a=NULL) {
+function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) {
 
     global $CFG;
 
@@ -4262,15 +4263,22 @@ function get_string($identifier, $module='', $a=NULL) {
 
 /// Define the two or three major locations of language strings for this module
 
+    $locations = array();
+
+    if (!empty($extralocations)) {   // Calling code has a good idea where to look
+        $locations += $extralocations;
+    }
+
     if (isset($CFG->running_installer)) {
         $module = 'installer';
         $filetocheck = 'installer.php';
-        $locations = array( $CFG->dirroot.'/install/lang/', $CFG->dataroot.'/lang/',  $CFG->dirroot.'/lang/' );
+        $locations += array( $CFG->dirroot.'/install/lang/', $CFG->dataroot.'/lang/',  $CFG->dirroot.'/lang/' );
         $defaultlang = 'en_utf8';
     } else {
-        $locations = array( $CFG->dataroot.'/lang/',  $CFG->dirroot.'/lang/' );
+        $locations += array( $CFG->dataroot.'/lang/',  $CFG->dirroot.'/lang/' );
     }
 
+
     if ($module != 'moodle' && $module != 'langconfig') {
         if (strpos($module, 'block_') === 0) {  // It's a block lang file
             $locations[] =  $CFG->dirroot .'/blocks/'.substr($module, 6).'/lang/';