From b6b970705e7355f7b74539b3fea019e86a04a9d7 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 7 Feb 2006 00:08:47 +0000 Subject: [PATCH] Initially the get_string() function, if any string wasn't found under one lang (or its parent), was searched from "en" or "en_utf8" (depending of the status of the DB migration). But "en" isn't one full lang anymore under 1.6 but one "child" of "en_utf8" and it's completely empty so we must look for the string into his new parent too. This should solve problems with upgraded sites using non-english languages that were showing brackets everywhere. Now they will show the english strings until they manually install lang packages (1.5 packs) or automatically (1.6 packs). --- lib/moodlelib.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d45a41067f8..73d7d683740 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -4787,6 +4787,31 @@ function get_string($identifier, $module='', $a=NULL) { } } +/// And, because under 1.6 en is defined as en_utf8 child, me must try +/// if it hasn't been queried before. + if ($defaultlang == 'en') { + $defaultlang = 'en_utf8'; + foreach ($locations as $location) { + $locallangfile = $location.$defaultlang.'_local/'.$module.'.php'; //first, see if there's a local file + if (file_exists($locallangfile)) { + if ($result = get_string_from_file($identifier, $locallangfile, "\$resultstring")) { + eval($result); + return $resultstring; + } + } + + //if local_en not found, or string not found in local_en + $langfile = $location.$defaultlang.'/'.$module.'.php'; + + if (file_exists($langfile)) { + if ($result = get_string_from_file($identifier, $langfile, "\$resultstring")) { + eval($result); + return $resultstring; + } + } + } + } + return '[['.$identifier.']]'; // Last resort }