Permalink
Browse files

Can now specify current language on a per-user basis

  • Loading branch information...
1 parent c46df33 commit 1a72314d0f05d0c9df5d387283ed5cac14d9c607 martin committed Sep 14, 2002
Showing with 34 additions and 1 deletion.
  1. +1 −0 lang/en/moodle.php
  2. +17 −0 lib/moodlelib.php
  3. +12 −0 user/edit.html
  4. +4 −1 version.php
View
@@ -325,6 +325,7 @@
$string[personalprofile] = "Personal profile";
$string[phone] = "Phone";
$string[potentialteachers] = "Potential teachers";
+$string[preferredlanguage] = "Preferred language";
$string[preview] = "Preview";
$string[previeworchoose] = "Preview or choose a theme";
$string[question] = "Question";
View
@@ -1517,6 +1517,23 @@ function get_string_from_file($identifier, $langfile, $destination) {
}
+function get_list_of_languages() {
+/// Returns a list of language codes and their full names
+ global $CFG;
+
+ if (!$langdirs = get_list_of_plugins("lang")) {
+ return false;
+ }
+
+ foreach ($langdirs as $lang) {
+ include("$CFG->dirroot/lang/$lang/moodle.php");
+ $languages[$lang] = $string["thislanguage"]." ($lang)";
+ unset($string);
+ }
+ return $languages;
+}
+
+
/// ENCRYPTION ////////////////////////////////////////////////
function rc4encrypt($data) {
View
@@ -126,6 +126,18 @@
<? formerr($err["country"]) ?>
</td>
</tr>
+<tr valign=top>
+ <td><P><? print_string("preferredlanguage") ?>:</td>
+ <td><? if ($languages = get_list_of_languages()) {
+ if (!$user->lang) {
+ $user->lang = "en";
+ }
+ choose_from_menu ($languages, "lang", $user->lang, "", "", "");
+ }
+ formerr($err["lang"]);
+ ?>
+ </td>
+</tr>
<tr valign=top>
<td><P><? print_string("timezone") ?>:</td>
<td><?
View
@@ -18,7 +18,7 @@
// If there's something it cannot do itself, it
// will tell you what you need to do.
-$version = 2002091300; // The current version is a date (YYYYMMDDXX) where
+$version = 2002091400; // The current version is a date (YYYYMMDDXX) where
// XX is a number that increments during the day
$release = "1.0.5 dev"; // For humans only, not used for the upgrade process
@@ -74,6 +74,9 @@ function upgrade_moodle($oldversion=0) {
if ($oldversion < 2002091000) {
execute_sql(" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) DEFAULT NULL ");
}
+ if ($oldversion < 2002091400) {
+ execute_sql(" ALTER TABLE `user` ADD `lang` VARCHAR( 3 ) DEFAULT 'en' NOT NULL AFTER `country` ");
+ }
return true;
}

0 comments on commit 1a72314

Please sign in to comment.