MDL-21694 simplified tinymce string handling

This commit is contained in:
Petr Skoda
2010-04-11 20:37:13 +00:00
parent c2ed166e6d
commit 3518913cc8
2 changed files with 20 additions and 52 deletions
+1 -51
View File
@@ -40,34 +40,7 @@ if ($lang === 'en') {
$lang = 'en';
}
// load english defaults
$string = array();
foreach (get_langpack_en_locations() as $location) {
if (!file_exists($location)) {
continue;
}
include($location);
}
// find parent language
if ($parent = get_parent_language($lang)) {
foreach (get_langpack_locations($parent) as $location) {
if (!file_exists($location)) {
continue;
}
include($location);
}
}
// load wanted language
if ($lang !== 'en') {
foreach (get_langpack_locations($lang) as $location) {
if (!file_exists($location)) {
continue;
}
include($location);
}
}
$string = get_string_manager()->load_component_strings('editor_tinymce', $lang);
//process the $strings to match expected tinymce lang array stucture
$result = array();
@@ -94,26 +67,3 @@ $lifetime = '10'; // TODO: increase later
@header('Pragma: ');
echo $output;
/// ======= Functions =================
function get_langpack_en_locations() {
global $CFG;
$result = array();
$result[] = "$CFG->dirroot/lib/editor/tinymce/lang/en/editor_tinymce.php";
$result[] = "$CFG->langlocalroot/en_local/editor_tinymce.php";
return $result;
}
function get_langpack_locations($lang) {
global $CFG;
$result = array();
$result[] = "$CFG->langotherroot/$lang/editor_tinymce.php";
$result[] = "$CFG->langlocalroot/{$lang}_local/editor_tinymce.php";
return $result;
}
+19 -1
View File
@@ -5712,6 +5712,14 @@ interface string_manager {
* @param bool $returnall return all or just enabled
*/
public function get_list_of_languages($returnall = false);
/**
* Load all strings for one component
* @param string $component The module the string is associated with
* @param string $lang
* @return array of all string for given component and lang
*/
public function load_component_strings($component, $lang);
}
@@ -5774,7 +5782,7 @@ class amos_string_manager implements string_manager {
* @param string $lang
* @return array of all string for given component and lang
*/
protected function load_component_strings($component, $lang) {
public function load_component_strings($component, $lang) {
global $CFG;
list($plugintype, $pluginname) = normalize_component($component);
@@ -6035,6 +6043,16 @@ class install_string_manager implements string_manager {
$this->installroot = "$CFG->dirroot/install/lang";
}
/**
* Load all strings for one component
* @param string $component The module the string is associated with
* @param string $lang
* @return array of all string for given component and lang
*/
public function load_component_strings($component, $lang) {
return array();
}
/**
* Get String returns a requested string
*