From b9b4e32ab95aa4504384d78576cbedd622ae9791 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 9 Mar 2006 20:24:14 +0000 Subject: [PATCH] Now it's possible to use any language in the installer. Next step: Add the possibility to download and install the selected language from the installer. --- install.php | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index 7765dccd83..e0e36ef842 100644 --- a/install.php +++ b/install.php @@ -42,7 +42,7 @@ $INSTALL = &$_SESSION['INSTALL']; // Makes it easier to reference if ( empty($INSTALL['language']) and empty($_POST['language']) ) { /// set defaults - $INSTALL['language'] = 'en'; + $INSTALL['language'] = 'en_utf8'; $INSTALL['dbhost'] = 'localhost'; $INSTALL['dbuser'] = ''; @@ -105,6 +105,7 @@ $CFG->libdir = $INSTALL['dirroot'].'/lib'; $CFG->dataroot = $INSTALL['dataroot']; $CFG->admin = $INSTALL['admindirname']; $CFG->directorypermissions = 00777; +$CFG->running_installer = true; /// Include some moodle libraries @@ -570,7 +571,7 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {

- + @@ -812,6 +813,36 @@ function check_memory_limit() { //==========================================================================// +/* This function returns a list of languages and their full names. The + * list of available languages is fetched from install/lang/xx/installer.php + * and it's used exclusively by the installation process + * @return array An associative array with contents in the form of LanguageCode => LanguageName + */ +function get_installer_list_of_languages() { + + global $CFG; + + $languages = array(); + +/// Get raw list of lang directories + $langdirs = get_list_of_plugins('install/lang'); + asort($langdirs); +/// Get some info from each lang + foreach ($langdirs as $lang) { + if (file_exists($CFG->dirroot .'/install/lang/'. $lang .'/installer.php')) { + include($CFG->dirroot .'/install/lang/'. $lang .'/installer.php'); + if (!empty($string['thislanguage'])) { + $languages[$lang] = $string['thislanguage'] .' ('. $lang .')'; + } + unset($string); + } + } +/// Return array + return $languages; +} + +//==========================================================================// + function css_styles() { ?> -- 2.39.5