]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Translation seems to be working
authorJean-Marc Pigeon <jmp@safe.c>
Sat, 6 Sep 2025 14:08:20 +0000 (10:08 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Sat, 6 Sep 2025 14:08:20 +0000 (10:08 -0400)
sql/datatest.sql
sql/mailleur.sql
www/gesdis.php [moved from www/unidis.php with 93% similarity]
www/lvllog.php
www/unienv.php
www/unilng.php [new file with mode: 0644]

index efeb35ad07b2654752af01a41c3dbd7c0f31ae98..0fead178406a52ddd998f0a1856471098898833b 100644 (file)
@@ -10,6 +10,8 @@ DELETE FROM emails;
 
 //==============================================================
 //set for local test
+INSERT INTO emails (email,password,lang)                       \
+        values ('jmp@example.com','tryit','FRA');
 INSERT INTO emails (email,password)                            \
         values ('root@example.com','4cabri');
 INSERT INTO emails (email,password)                            \
@@ -70,4 +72,6 @@ INSERT INTO remotes (remoteip,credit)                         \
 //defining admin user
 INSERT INTO admins (email)                             \
          values ('root@example.com');
+INSERT INTO admins (email)                             \
+         values ('jmp@example.com');
 //==============================================================
index 1010ee09e2c64ad30bdba9fb38a14a7d79cacec8..8222e5e899fe75cf763fc5f44d0334db0bee4ff6 100644 (file)
@@ -60,6 +60,8 @@ CREATE TABLE emails   (
        password        TEXT            //user (encrypted) password
                        DFLT '!',
        hash            TEXT,           //'email:realm:password' MD5
+       lang            TEXT            //user prefered language
+                       DFLT 'ENG',     //English by default
        space           INTEGER         //space used by user email      
                        DFLT 0,
        mxspace         INTEGER         //Maximun space available
similarity index 93%
rename from www/unidis.php
rename to www/gesdis.php
index 609e5d5fecda145cc21a594088021a24989446ec..7a282c2094ba4981fd6273d34e09e71ea2017cbe 100644 (file)
@@ -2,10 +2,10 @@
 
 //==============================================================
 //                                                             
-//     Basic display function
+//      Display management function
 //
 //==============================================================
-
+include_once "unilng.php";
 
 //==============================================================
 //
@@ -24,7 +24,8 @@ if ($isadmin==true)
   $admcolor="red";
 switch ($pageref) {
   case "lvllog"        :
-    $entete="Authentication";
+    $entete=gettranslate(lng::fra,"authentication");
+    //$entete=gettranslate(lng::fra,"nuts");
     break;
   case "lvlmai"        :
     $entete="main";
index 5c38cfdf03f7cec48821d2d666c5649300247465..e9fe253d24bb463b974d66dfd8dd408d5979af13 100644 (file)
@@ -7,7 +7,7 @@
 //==============================================================
 include_once "subrou.php";
 include_once "unienv.php";
-include_once "unidis.php";
+include_once "gesdis.php";
 include_once "gessql.php";
 
 //==============================================================
index 0e42e8c315fefefe011fb2744c8cab36d62a047e..d2be85c0823e24f0223568fe4f775441fe6daebf 100644 (file)
@@ -2,7 +2,7 @@
 
 //==============================================================
 //
-//     To load environement variable
+//     To load environment variable
 //
 //==============================================================
 function loadenv()
diff --git a/www/unilng.php b/www/unilng.php
new file mode 100644 (file)
index 0000000..4e1d72a
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+//==============================================================
+//
+//     To manage language
+//
+//==============================================================
+
+//list of available word
+
+enum lng {
+  case eng;    //English default language
+  case fra;    //French
+  case unk;    //Unk language (english)
+  }
+
+
+
+
+function gettranslate(lng $lang,$mot)
+
+{
+$english =array        (
+               "authentication"
+               );
+
+$francais=array        (
+               "authentification"
+               );
+
+$translate=$mot;
+$num=array_search($mot,$english,true);
+if ($num!='') {
+  switch ($lang) {
+    case lng::fra:     //French
+      $translate=$francais[$num];
+      break;
+    case lng::eng:     //English
+    default    :       //No break;
+      break;
+    }
+  }
+return $translate;
+}
+?>