diff --git a/admin/settings/language.php b/admin/settings/language.php index b38941a192d..e081834a85d 100644 --- a/admin/settings/language.php +++ b/admin/settings/language.php @@ -13,6 +13,7 @@ if ($hassiteconfig $temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1)); $temp->add(new admin_setting_langlist()); $temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1)); + $temp->add(new admin_setting_configcheckbox('langstringcache', get_string('langstringcache', 'admin'), get_string('configlangstringcache', 'admin'), 1)); $temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE)); $temp->add(new admin_setting_configselect('latinexcelexport', get_string('latinexcelexport', 'admin'), get_string('configlatinexcelexport', 'admin'), '0', array('0'=>'Unicode','1'=>'Latin'))); diff --git a/lang/en/admin.php b/lang/en/admin.php index 0793199a44b..64246d5b79d 100755 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -241,6 +241,7 @@ $string['configiplookup'] = 'When you click on an IP address (such as 34.12.222. $string['configkeeptagnamecase'] = 'Check this if you want tag names to keep the original casing as entered by users who created them'; $string['configlang'] = 'Choose a default language for the whole site. Users can override this setting later. You can also set $CFG->lang="yourlangcode_utf8"; in config.php if you want localised error messages for database connection problems.'; $string['configlangcache'] = 'Cache the language menu. Saves a lot of memory and processing power. If you enable this, the menu takes a few minutes to update after you have added or removed languages.'; +$string['configlangstringcache'] = 'Caches all the language strings into compiled files in the data directory. If you are translating Moodle or changing strings in the Moodle source code then you may want to switch this off. Otherwise leave it on to see performance benefits.'; $string['configlangdir'] = 'Most languages are printed left-to-right, but some, like Arabic and Hebrew, are printed right-to-left.'; $string['configlanglist'] = 'Leave this blank to allow users to choose from any language you have in this installation of Moodle. However, you can shorten the language menu by entering a comma-separated list of language codes that you want. For example: en,es_es,fr,it'; $string['configlangmenu'] = 'Choose whether or not you want to display the general-purpose language menu on the home page, login page etc. This does not affect the user\'s ability to set the preferred language in their own profile.'; @@ -620,6 +621,7 @@ $string['langpackupdated'] = 'Language pack {$a} was successfully updated'; $string['langpackupdateskipped'] = 'Update of {$a} language pack skipped'; $string['langpackwillbeupdated'] = 'Note for translators: During the upgrade, Moodle will try to update your language pack. Your modifications in non-local language folders will be overwritten.'; $string['langrmyourself'] = 'To prevent data loss, lang.php is not able to overwrite existing file with empty content. Please, remove the file manually in order to get rid of it.'; +$string['langstringcache'] = 'Cache all language strings'; $string['languagesettings'] = 'Language settings'; $string['langupdatecomplete'] = 'Language pack update completed'; $string['lang16notify'] = 'Moodle 1.6 and above allows you to install and update language packs directly from download.moodle.org by following the link below'; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a555c5c2940..c93646110f5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -5934,7 +5934,7 @@ class core_string_manager implements string_manager { } // try on-disk cache then - if (empty($CFG->disablelangdiskcache) and file_exists($this->cacheroot . "/$lang/$component")) { + if (!empty($CFG->langstringcache) and file_exists($this->cacheroot . "/$lang/$component")) { $this->countdiskcache++; eval('$this->cache[$lang][$component] = ' . file_get_contents($this->cacheroot . "/$lang/$component") . ';'); return $this->cache[$lang][$component]; @@ -6015,7 +6015,7 @@ class core_string_manager implements string_manager { // now we have a list of strings from all possible sources. put it into both in-memory and on-disk // caches so we do not need to do all this merging and dependecies resolving again $this->cache[$lang][$component] = $string; - if (empty($CFG->disablelangdiskcache)) { + if (!empty($CFG->langstringcache)) { check_dir_exists($this->cacheroot . '/' . $lang, true, true); file_put_contents($this->cacheroot . "/$lang/$component", var_export($string, true)); }