From b53b73bdb8f2851f767fcb9d05b656b32ac0074d Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 2 Oct 2006 15:08:25 +0000 Subject: [PATCH] Additional paramter for get_string() that allows the calling code to specify extra locations for strings --- lib/moodlelib.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 7de98adeb3..944916a549 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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/'; -- 2.39.5