浏览代码

Added localization for authreq

TC pushbot 5 4 年之前
父节点
当前提交
ecdded5c02
共有 3 个文件被更改,包括 50 次插入4 次删除
  1. 1 1
      start.sh
  2. 31 0
      web/SystemAO/locale/authreq.json
  3. 18 3
      web/SystemAO/security/authreq.html

+ 1 - 1
start.sh

@@ -1,2 +1,2 @@
 #!/bin/bash
-sudo ./arozos -port 8082 -hostname "ixtw" -tls=true -tls_port 8443
+sudo ./arozos -port 8080 -tls=true -tls_port 8443

+ 31 - 0
web/SystemAO/locale/authreq.json

@@ -0,0 +1,31 @@
+{
+    "author": "tobychui",
+    "version": "1.0",
+    "keys": {
+        "zh-tw": {
+            "strings":{
+                "page/title" : "管理員身份驗證 ",
+                "button/confirm":"確認",
+                "button/cancel":"取消",
+                "":""
+            },
+            "placeholder":{
+                "Username":"使用者名稱",
+                "Password":"密碼"
+            }
+        }, 
+        "zh-hk": {
+            "strings":{
+                "page/title" : "管理員身份驗證 ",
+                "button/confirm":"確認",
+                "button/cancel":"取消",
+                "":""
+            },
+            "placeholder":{
+                "Username":"使用者名稱",
+                "Password":"密碼"
+            }
+        }
+
+    }
+}

+ 18 - 3
web/SystemAO/security/authreq.html

@@ -1,13 +1,14 @@
 <!DOCTYPE html>
 <html>
 <head>
-    <title>Authentication Required</title>
+    <title locale="page/title">Authentication Required</title>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
     <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
     <script type="text/javascript" src="../../script/jquery.min.js"></script>
     <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
     <script type="text/javascript" src="../../script/ao_module.js"></script>
+    <script type="text/javascript" src="../../script/applocale.js"></script>
     <style>
         .topSlate{
             background-image: url("img/auth_slate.png");
@@ -47,8 +48,8 @@
         </div>
         <br>
         <div align="right">
-            <button class="ui blue button" onclick="confirm()">Confirm</button>
-            <button class="ui button" onclick="cancel()">Cancel</button>
+            <button class="ui black button" locale="button/confirm" onclick="confirm()">Confirm</button>
+            <button class="ui button" locale="button/cancel" onclick="cancel()">Cancel</button>
         </div>
         
     </div>
@@ -153,6 +154,20 @@
 
             ao_module_close();
        }
+
+       if (applocale){
+            //Applocale found. Do localization
+            applocale.init("../locale/authreq.json", function(){
+                applocale.translate();
+            });
+        }else{
+            //Applocale not found. Is this a trim down version of ArozOS?
+            var applocale = {
+                getString: function(key, original){
+                    return original;
+                }
+            }
+        }
     </script>
 </body>
 </html>