]> git.mjollnir.org Git - moodle.git/commitdiff
Can now specify current language on a per-user basis
authormartin <martin>
Sat, 14 Sep 2002 03:43:24 +0000 (03:43 +0000)
committermartin <martin>
Sat, 14 Sep 2002 03:43:24 +0000 (03:43 +0000)
lang/en/moodle.php
lib/moodlelib.php
user/edit.html
version.php

index e28878098204bfabd72ec65aee62b46e19cf862f..e8b7caaafccff96ec4ed9463e8b837dd460ccd91 100644 (file)
@@ -325,6 +325,7 @@ $string[people] = "People";
 $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";
index edc17c1652c93cff79405231a54de0713faa9eec..50c4c90e55a227ec2c4e745f42e67528b86a0d6b 100644 (file)
@@ -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) {
index 290527ff59e5f969138a66bee40dabeab9c31717..df49f26a0efa6162d8bddc659cf8f0501040be15 100644 (file)
@@ -126,6 +126,18 @@ if (isadmin()) {
        <? 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><?
index 08390b89ad96c2f97f25a5e39b74e13edc9a066b..493908fb7fec0a644f77f97eb1d12243f780e1b1 100644 (file)
@@ -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;
 }