1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00

Additional paramter for get_string() that allows the calling code to

specify extra locations for strings
This commit is contained in:
moodler 2006-10-02 15:08:25 +00:00
parent 85489a5b42
commit b53b73bdb8

@ -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/';