mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-22084 making a clear distinction between list of our translations and list of all languages defined in ISO 639-2
This commit is contained in:
parent
b2ad1a3aea
commit
1f96e907ea
@ -190,7 +190,7 @@ echo get_string('cliinstallheader', 'install', $CFG->target_release)."\n";
|
||||
//Fist select language
|
||||
if ($interactive) {
|
||||
cli_separator();
|
||||
$languages = get_list_of_languages();
|
||||
$languages = get_string_manager()->get_list_of_translations();
|
||||
// format the langs nicely - 3 per line
|
||||
$c = 0;
|
||||
$langlist = '';
|
||||
|
@ -203,11 +203,6 @@
|
||||
}
|
||||
mtrace('Finished admin reports');
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages(true);
|
||||
}
|
||||
|
||||
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
|
||||
$timenow = time();
|
||||
$somefound = false;
|
||||
|
@ -41,7 +41,7 @@ die('Work in progress, to be replaced by the new language update interface...');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
print_error('cannotdeletelangcache', 'error');
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
//TODO: refresh lang cache
|
||||
|
||||
$notice_ok = array();
|
||||
$notice_error = array();
|
||||
@ -123,7 +123,7 @@ die('Work in progress, to be replaced by the new language update interface...');
|
||||
if (file_exists($dest2)){
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
//TODO: refresh lang cache
|
||||
//delete the direcotries
|
||||
if ($rm1 or $rm2) {
|
||||
$notice_ok[] = get_string('langpackremoved','admin');
|
||||
@ -140,7 +140,7 @@ die('Work in progress, to be replaced by the new language update interface...');
|
||||
//key = langname, value = md5
|
||||
$md5array = array();
|
||||
$updated = 0; //any packs updated?
|
||||
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
|
||||
$alllangs = array_keys(get_string_manager()->get_list_of_translations(true)); //get all available langs
|
||||
$lang20 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
|
||||
$packs = array(); //all the packs that needs updating
|
||||
|
||||
@ -245,7 +245,7 @@ die('Work in progress, to be replaced by the new language update interface...');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$installedlangs = get_list_of_languages(true, true);
|
||||
$installedlangs = get_string_manager()->get_list_of_translations(true);
|
||||
|
||||
$missingparents = array();
|
||||
$oldlang = isset($SESSION->lang) ? $SESSION->lang : null; // override current lang
|
||||
|
@ -106,7 +106,7 @@ if ($hassiteconfig
|
||||
$temp->add(new admin_setting_heading('language', get_string('language'), ''));
|
||||
$languages=array();
|
||||
$languages[''] = get_string('forceno');
|
||||
$languages += get_list_of_languages();
|
||||
$languages += get_string_manager()->get_list_of_translations();
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/lang', get_string('forcelanguage'), '',key($languages),$languages));
|
||||
|
||||
if (!empty($CFG->enablecompletion)) {
|
||||
|
@ -9,7 +9,7 @@ if ($hassiteconfig
|
||||
// "languageandlocation" settingpage
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('autolang', get_string('autolang', 'admin'), get_string('configautolang', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en is in setup.php
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_string_manager()->get_list_of_translations())); // $CFG->lang might be set in installer already, default en is in setup.php
|
||||
$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));
|
||||
|
@ -209,7 +209,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
$mform->setDefault('timezone', $templateuser->timezone);
|
||||
$mform->setAdvanced('timezone');
|
||||
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
|
||||
$mform->setDefault('lang', $templateuser->lang);
|
||||
$mform->setAdvanced('lang');
|
||||
|
||||
|
@ -2848,7 +2848,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
if (!empty($userids)) {
|
||||
|
||||
/// Get languages for quick search later
|
||||
$languages = get_list_of_languages();
|
||||
$languages = get_string_manager()->get_list_of_translations();
|
||||
|
||||
/// Iterate over all users loaded from xml
|
||||
$counter = 0;
|
||||
|
@ -365,7 +365,7 @@ class course_edit_form extends moodleform {
|
||||
|
||||
$languages=array();
|
||||
$languages[''] = get_string('forceno');
|
||||
$languages += get_list_of_languages();
|
||||
$languages += get_string_manager()->get_list_of_translations();
|
||||
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
|
||||
$mform->setDefault('lang', $courseconfig->lang);
|
||||
|
||||
|
@ -605,7 +605,7 @@ if ($distro) {
|
||||
get_string('chooselanguagesub', 'install'));
|
||||
}
|
||||
|
||||
$languages = get_list_of_languages();
|
||||
$languages = get_string_manager()->get_list_of_translations();
|
||||
echo '<div class="userinput">';
|
||||
echo '<div class="formrow"><label class="formlabel" for="langselect">'.get_string('language').'</label>';
|
||||
echo '<select id="langselect" name="lang" class="forminput" onchange="this.form.submit()">';
|
||||
|
@ -3517,7 +3517,7 @@ class admin_setting_langlist extends admin_setting_configtext {
|
||||
*/
|
||||
public function write_setting($data) {
|
||||
$return = parent::write_setting($data);
|
||||
get_list_of_languages(true);//refresh the list
|
||||
//TODO: reset lang cache
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,20 @@ function auth_get_plugin_title($authtype) {
|
||||
return get_string('pluginname', "auth_{$authtype}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Was returning list of translations, use new string_manager instead
|
||||
*
|
||||
* @deprecated
|
||||
* @param bool $refreshcache force refreshing of lang cache
|
||||
* @param bool $returnall ignore langlist, return all languages available
|
||||
* @return array An associative array with contents in the form of LanguageCode => LanguageName
|
||||
*/
|
||||
function get_list_of_languages($refreshcache=false, $returnall=false) {
|
||||
if ($refreshcache) {
|
||||
// TODO: reset lang cache
|
||||
}
|
||||
return get_string_manager()->get_list_of_translations($returnall);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
|
@ -755,7 +755,7 @@ function clean_param($param, $type) {
|
||||
|
||||
case PARAM_LANG:
|
||||
$param = clean_param($param, PARAM_SAFEDIR);
|
||||
$langs = get_list_of_languages(false, true);
|
||||
$langs = get_string_manager()->get_list_of_translations(true);
|
||||
if (in_array($param, $langs)) {
|
||||
return $param;
|
||||
} else {
|
||||
@ -3296,8 +3296,8 @@ function create_user_record($username, $password, $auth='manual') {
|
||||
// fix for MDL-8480
|
||||
// user CFG lang for user if $newuser->lang is empty
|
||||
// or $user->lang is not an installed language
|
||||
$sitelangs = array_keys(get_list_of_languages());
|
||||
if (empty($newuser->lang) || !in_array($newuser->lang, $sitelangs)) {
|
||||
$sitelangs = get_string_manager()->get_list_of_translations();
|
||||
if (empty($newuser->lang) || !isset($sitelangs[$newuser->lang])) {
|
||||
$newuser->lang = $CFG->lang;
|
||||
}
|
||||
$newuser->confirmed = 1;
|
||||
@ -5722,10 +5722,10 @@ interface string_manager {
|
||||
public function get_list_of_countries();
|
||||
|
||||
/**
|
||||
* Returns localised list of installed languages
|
||||
* Returns localised list of installed translations
|
||||
* @param bool $returnall return all or just enabled
|
||||
*/
|
||||
public function get_list_of_languages($returnall = false);
|
||||
public function get_list_of_translations($returnall = false);
|
||||
|
||||
/**
|
||||
* Load all strings for one component
|
||||
@ -5996,10 +5996,10 @@ class core_string_manager implements string_manager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns localised list of installed languages
|
||||
* Returns localised list of installed translations
|
||||
* @param bool $returnall return all or just enabled
|
||||
*/
|
||||
public function get_list_of_languages($returnall = false) {
|
||||
public function get_list_of_translations($returnall = false) {
|
||||
global $CFG;
|
||||
|
||||
$languages = array();
|
||||
@ -6190,10 +6190,10 @@ class install_string_manager implements string_manager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns localised list of installed languages
|
||||
* Returns localised list of installed translations
|
||||
* @param bool $returnall return all or just enabled
|
||||
*/
|
||||
public function get_list_of_languages($returnall = false) {
|
||||
public function get_list_of_translations($returnall = false) {
|
||||
// return all is ignored here - we need to know all langs in installer
|
||||
$languages = array();
|
||||
// Get raw list of lang directories
|
||||
@ -6344,24 +6344,6 @@ function print_string($identifier, $component = '', $a = NULL) {
|
||||
echo get_string($identifier, $component, $a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of language codes and their full names
|
||||
* hides the _local files from everyone.
|
||||
*
|
||||
* @global object
|
||||
* @param bool $refreshcache force refreshing of lang cache
|
||||
* @param bool $returnall ignore langlist, return all languages available
|
||||
* @return array An associative array with contents in the form of LanguageCode => LanguageName
|
||||
*/
|
||||
function get_list_of_languages($refreshcache=false, $returnall=false) {
|
||||
|
||||
if ($refreshcache) {
|
||||
// TODO: reimplement caching?; this may not be necessary if we implement lang pack precompilation in dataroot
|
||||
}
|
||||
|
||||
return get_string_manager()->get_list_of_languages($returnall);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of charset codes
|
||||
*
|
||||
@ -9109,7 +9091,7 @@ function setup_lang_from_browser() {
|
||||
}
|
||||
krsort($langs, SORT_NUMERIC);
|
||||
|
||||
$langlist = get_list_of_languages();
|
||||
$langlist = get_string_manager()->get_list_of_translations();
|
||||
|
||||
/// Look for such langs under standard locations
|
||||
foreach ($langs as $lang) {
|
||||
|
@ -675,7 +675,7 @@ class core_renderer extends renderer_base {
|
||||
}
|
||||
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
$langs = get_string_manager()->get_list_of_translations();
|
||||
|
||||
if (count($langs) < 2) {
|
||||
return '';
|
||||
|
@ -217,7 +217,7 @@ function useredit_shared_definition(&$mform, $editoroptions = null) {
|
||||
$mform->setDefault('timezone', '99');
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
|
||||
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
|
||||
$mform->setDefault('lang', $CFG->lang);
|
||||
|
||||
if (!empty($CFG->allowuserthemes)) {
|
||||
|
@ -100,7 +100,7 @@ class moodle_user_external extends external_api {
|
||||
unset($availableauths['webservice']); // we do not want new webservice users for now
|
||||
|
||||
$availablethemes = get_plugin_list('theme');
|
||||
$availablelangs = get_list_of_languages();
|
||||
$availablelangs = get_string_manager()->get_list_of_translations();
|
||||
|
||||
$transaction = $DB->start_delegated_transaction();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user