From: moodler Date: Mon, 24 May 2004 09:19:59 +0000 (+0000) Subject: Moodle will look for language files within modules as a last resort. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=cdac797c5d675cc6340bd45ab419bbc4de1a6784;p=moodle.git Moodle will look for language files within modules as a last resort. eg moodle/mod/somemodule/lang/en/somemodule.php --- diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a4736bc91a..94409c2a92 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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 }