]> git.mjollnir.org Git - moodle.git/commitdiff
Moodle will look for language files within modules as a last resort.
authormoodler <moodler>
Mon, 24 May 2004 09:19:59 +0000 (09:19 +0000)
committermoodler <moodler>
Mon, 24 May 2004 09:19:59 +0000 (09:19 +0000)
eg   moodle/mod/somemodule/lang/en/somemodule.php

lib/moodlelib.php

index a4736bc91ae968b1cca8910245ce6c28706389b5..94409c2a9241d37b4c5a13eaa007eda1ad303ba9 100644 (file)
@@ -1725,8 +1725,20 @@ function get_string($identifier, $module="", $a=NULL) {
         }
     }
 
-    // If the preferred language was English we can abort now
+    // If it's a module, then look within the module pack itself mod/xxxx/lang/en/module.php
+
+    if ($module != "moodle") {
+        $modlangpath = "$CFG->dirroot/mod/$module/lang";
+        $langfile = "$modlangpath/$lang/$module.php";
+        if (file_exists($langfile)) {
+            if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
+                eval($result);
+                return $resultstring;
+            }
+        }
+    }
 
+    // If the preferred language was English we can abort now
     if ($lang == "en") {
         return "[[$identifier]]";
     }
@@ -1757,6 +1769,18 @@ function get_string($identifier, $module="", $a=NULL) {
         return $resultstring;
     }
 
+    // If it's a module, then look within the module pack itself mod/xxxx/lang/en/module.php
+
+    if ($module != "moodle") {
+        $langfile = "$modlangpath/en/$module.php";
+        if (file_exists($langfile)) {
+            if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) {
+                eval($result);
+                return $resultstring;
+            }
+        }
+    }
+
     return "[[$identifier]]";  // Last resort
 }