$CFG->dataroot = $config->dataroot;
$CFG->admin = $config->admin;
$CFG->docroot = 'http://docs.moodle.org';
+$CFG->langotherroot = $CFG->dataroot.'/lang';
+$CFG->langlocalroot = $CFG->dataroot.'/lang';
$CFG->directorypermissions = 00777;
$CFG->running_installer = true;
$CFG->early_install_lang = true;
if ($cd->install() == COMPONENT_ERROR) {
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
- $a->url = 'http://download.moodle.org/lang20/'.$INSTALL['language'].'.zip';
+ $a->url = 'http://download.moodle.org/lang20/'.$config->lang.'.zip';
$a->dest = $CFG->dataroot.'/lang';
$downloaderror = get_string($cd->get_error(), 'error', $a);
} else {
* @return string The String !
*/
public function get_string($identifier, $component = '', $a = NULL) {
+ if (!$component) {
+ $component = 'moodle';
+ }
$lang = current_language();
+ //get parent lang
+ $parent = '';
+ if ($lang !== 'en' and $identifier !== 'parentlanguage' and $component !== 'langconfig') {
+ if (file_exists("$this->installroot/$lang/langconfig.php")) {
+ $string = array();
+ include("$this->installroot/$lang/langconfig.php");
+ if (isset($string['parentlanguage'])) {
+ $parent = $string['parentlanguage'];
+ }
+ unset($string);
+ }
+ }
+
+ // include en string first
+ if (!file_exists("$this->installroot/en/$component.php")) {
+ return "[[$identifier]]";
+ }
$string = array();
- include("$this->installroot/en/installer.php");
+ include("$this->installroot/en/$component.php");
+
+ // now override en with parent if defined
+ if ($parent and $parent !== 'en' and file_exists("$this->installroot/$parent/$component.php")) {
+ include("$this->installroot/$parent/$component.php");
+ }
- if (file_exists("$this->installroot/$lang/installer.php") and $lang !== 'en') {
- include("$this->installroot/$lang/installer.php");
+ // finally override with requested language
+ if ($lang !== 'en' and file_exists("$this->installroot/$lang/$component.php")) {
+ include("$this->installroot/$lang/$component.php");
}
if (!isset($string[$identifier])) {
// we do not support numeric keys - sorry!
continue;
}
- $search[] = '$a->'.$key.'';
- //$search[] = '{$a->'.$key.'}'; // TODO: uncomment after switch to {a->aa}
+ $search[] = '{$a->'.$key.'}';
$replace[] = (string)$value;
}
if ($search) {
$string = str_replace($search, $replace, $string);
}
} else {
- $string = str_replace('$a', (string)$a, $string);
- //$string = str_replace('{$a}', (string)$a, $string); // TODO: uncomment after switch to {a}
+ $string = str_replace('{$a}', (string)$a, $string);
}
}
asort($langdirs);
// Get some info from each lang
foreach ($langdirs as $lang) {
- if (file_exists($this->installroot.'/'.$lang.'/installer.php')) {
+ if (file_exists($this->installroot.'/'.$lang.'/langconfig.php')) {
$string = array();
- include($this->installroot.'/'.$lang.'/installer.php');
+ include($this->installroot.'/'.$lang.'/langconfig.php');
if (!empty($string['thislanguage'])) {
$languages[$lang] = $string['thislanguage'].' ('.$lang.')';
}