tobychui 2 лет назад
Родитель
Сommit
9fddd4c816

+ 69 - 61
web/SystemAO/boot/bootflags.html

@@ -7,6 +7,7 @@
         <script type="text/javascript" src="../../script/jquery.min.js"></script>
         <script type="text/javascript" src="../../script/semantic/semantic.min.js"></script>
         <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
+        <script type="text/javascript" src="../../script/applocale.js"></script>
         <style>
 
         </style>
@@ -17,81 +18,89 @@
                 <h3 class="ui header">
                     <i class="play icon"></i>
                     <div class="content">
-                        Runtime Adjustment
-                      <div class="sub header">Update system startup parameters in runtime</div>
+                        <span locale="runtime/runtime_adjustment">Runtime Adjustment</span>
+                        <div class="sub header" locale="runtime/update_system_startup_parameters">Update system startup parameters in runtime</div>
                     </div>
                 </h3>
                 <div class="ui divider"></div>
-            <form id="setupform" class="ui form" onsubmit="handleFormSubmit(event, this);">
-                <div class="field">
-                    <label>Host Name</label>
-                    <input class="config" type="text" name="Hostname" placeholder="My ArOZ">
-                </div>
-                <div class="field">
-                    <label>Max Upload Size (MB)</label>
-                    <input class="config" type="number" name="MaxUploadSize" placeholder="8192">
-                </div>
-                <div class="field">
-                    <label>File Upload Buffer (MB)</label>
-                    <input class="config" type="number" name="MaxFileUploadBuff" placeholder="25">
-                </div>
-                <div class="field">
-                    <label>File IO Buffer (Bytes, Defailt 1024)</label>
-                    <input class="config" type="number" name="FileIOBuffer" placeholder="1024">
-                </div>
-                <div class="field">
-                    <div class="ui toggle checkbox">
-                      <input class="config" type="checkbox" name="DisableIPResolver" tabindex="0">
-                      <label>Disable IP Resolver</label>
-                      <small>Not trying to analysis Client IP address, useful when the server is host under NAT or Reverse Proxy</small>
+                <form id="setupform" class="ui form" onsubmit="handleFormSubmit(event, this);">
+                    <div class="field">
+                        <label locale="runtime/host_name">Host Name</label>
+                        <input class="config" type="text" name="Hostname" placeholder="My ArOZ">
                     </div>
-                </div>
-                <div class="field">
-                    <div class="ui toggle checkbox">
-                      <input class="config" type="checkbox" name="EnableHomePage" tabindex="0">
-                      <label>Enable Home Page</label>
-                      <small>Allowing users to host their own static webpages</small>
+                    <div class="field">
+                        <label locale="runtime/max_upload_size">Max Upload Size (MB)</label>
+                        <input class="config" type="number" name="MaxUploadSize" placeholder="8192">
                     </div>
-                </div>
-                <div class="field">
-                    <div class="ui toggle checkbox">
-                      <input class="config" type="checkbox" name="EnableDirListing" tabindex="0">
-                      <label>Enable Directory Listing</label>
-                      <small>Allow listing the contents of a directory if the request URL is a folder</small>
+                    <div class="field">
+                        <label locale="runtime/file_upload_buffer">File Upload Buffer (MB)</label>
+                        <input class="config" type="number" name="MaxFileUploadBuff" placeholder="25">
                     </div>
-                </div>
-                <div class="ui divider"></div>
-                <p>To continue updating your boot configuration, please confirm that: </p>
-                <div class="field">
-                    <div class="ui checkbox">
-                    <input type="checkbox" tabindex="0" onchange="toggleConfirmBtn(this.checked)">
-                    <label>I know exactly what I am doing</label>
-                    <small>These changes are only applied to current runtime session. If something messed up, you can restart your system for restoring to default value. </small>
+                    <div class="field">
+                        <label locale="runtime/file_io_buffer">File IO Buffer (Bytes, Default 1024)</label>
+                        <input class="config" type="number" name="FileIOBuffer" placeholder="1024">
                     </div>
+                    <div class="field">
+                        <div class="ui toggle checkbox">
+                            <input class="config" type="checkbox" name="DisableIPResolver" tabindex="0">
+                            <label locale="runtime/disable_ip_resolver">Disable IP Resolver</label>
+                            <small locale="runtime/disable_ip_resolver_note">Not trying to analyze Client IP address, useful when the server is hosted under NAT or Reverse Proxy</small>
+                        </div>
+                    </div>
+                    <div class="field">
+                        <div class="ui toggle checkbox">
+                            <input class="config" type="checkbox" name="EnableHomePage" tabindex="0">
+                            <label locale="runtime/enable_home_page">Enable Home Page</label>
+                            <small locale="runtime/enable_home_page_note">Allowing users to host their own static web pages</small>
+                        </div>
+                    </div>
+                    <div class="field">
+                        <div class="ui toggle checkbox">
+                            <input class="config" type="checkbox" name="EnableDirListing" tabindex="0">
+                            <label locale="runtime/enable_directory_listing">Enable Directory Listing</label>
+                            <small locale="runtime/enable_directory_listing_note">Allow listing the contents of a directory if the request URL is a folder</small>
+                        </div>
+                    </div>
+                    <div class="ui divider"></div>
+                    <p locale="runtime/confirmation_message">To continue updating your boot configuration, please confirm that: </p>
+                    <div class="field">
+                        <div class="ui checkbox">
+                            <input type="checkbox" tabindex="0" onchange="toggleConfirmBtn(this.checked)">
+                            <label locale="runtime/i_know_what_i_am_doing">I know exactly what I am doing</label>
+                            <small locale="runtime/i_know_what_i_am_doing_note">These changes are only applied to the current runtime session. If something goes wrong, you can restart your system to restore it to the default value.</small>
+                        </div>
+                    </div>
+                    <button id="confirmbtn" class="ui red disabled button" type="submit" locale="runtime/write_to_runtime">Write to Runtime</button>
+                </form>
+                <div class="ui red message" style="display:none;" id="failedmsg" locale="runtime/update_failed">
+                    <div class="header">
+                        <i class="remove icon"></i> Flags Update Failed
+                    </div>
+                    <ul class="list">
+                        <p id="errmsg">Your settings were not applied due to an unknown error.</p>
+                    </ul>
                 </div>
-                <button id="confirmbtn" class="ui red disabled button" type="submit">Write to Runtime</button>
-            </form>
-            <div class="ui red message" style="display:none;" id="failedmsg">
-                <div class="header">
-                    <i class="remove icon"></i> Flags Update Failed
-                </div>
-                <ul class="list">
-                    <p id="errmsg">Your settings were not applied due to unknown error.</p>
-                </ul>
-            </div>
-            <div id="succmsg" class="ui green message transition" style="display:none;">
-                <div class="header">
-                    <i class="checkmark icon"></i> Startup paramter Updated
+                <div id="succmsg" class="ui green message transition" style="display:none;" locale="runtime/param_updated">
+                    <div class="header">
+                        <i class="checkmark icon"></i> Startup parameter Updated
+                    </div>
+                    <ul class="list">
+                        <p locale="runtime/param_updated_note">These settings will only be available in the current runtime session. Restart your server to restore the original settings.</p>
+                    </ul>
                 </div>
-                <ul class="list">
-                    <p>These settings will only be available in current runtime session. Restart your server to restore original settings.</p>
-                </ul>
             </div>
         </div>
+        
             <br><br>
         </div>
         <script>
 
+            var runtimeLocale = NewAppLocale();
+            runtimeLocale.init("../locale/system_info_runtime.json", function(){
+                runtimeLocale.translate();
+                initCurrentSettingList();
+            });
+
             function handleFormSubmit(event, obj){
                 event.preventDefault();
                 var result = {};
@@ -126,7 +135,6 @@
                 })
             }
 
-            initCurrentSettingList();
             function initCurrentSettingList(){
                 $.get("../../system/bootflags", function(data){
                     if (data.errpr !== undefined){

+ 20 - 17
web/SystemAO/boot/poweroff.html

@@ -15,13 +15,12 @@
     </head>
     <body>
         <div class="ui container">
-            
             <div class="ui basic segment">
                 <h3 class="ui header">
                     <i class="power icon"></i>
                     <div class="content">
-                        Host Power
-                        <div class="sub header">Change power state of your device</div>
+                        <span locale="hostPower/host_power_title">Host Power</span>
+                        <div class="sub header" locale="hostPower/change_power_state">Change power state of your device</div>
                     </div>
                 </h3>
             </div>
@@ -30,16 +29,16 @@
                 <h3 class="ui header">
                     <i id="sysConnStateIcon" class="green check circle icon"></i>
                     <div class="content">
-                        <span id="sysConnState">System Online</span>
-                        <div class="sub header">Last update: <span id="lastupdateTime"></span></div>
+                        <span id="sysConnState" locale="hostPower/system_online">System Online</span>
+                        <div class="sub header"><span locale="hostPower/last_update">Last update: </span><span id="lastupdateTime"></span></div>
                     </div>
                 </h3>
             </div>
            
             <div class="ui divider"></div>
-            <p>Power Options</p>
-            <button class="ui red button" onclick="shutdown();"><i class="power off icon"></i> Power Off</button>
-            <button class="ui yellow button" onclick="restart();"><i class="refresh icon"></i> Restart</button>
+            <p locale="hostPower/power_options">Power Options</p>
+            <button class="ui red button" onclick="shutdown();"><i class="power off icon"></i> <span locale="hostPower/power_off">Power Off</span></button>
+            <button class="ui yellow button" onclick="restart();"><i class="refresh icon"></i> <span locale="hostPower/restart">Restart</span></button>
             <div id="msgbox" class="ui green message" style="display:none;">
                 <p><i class="checkmark icon"></i> <span id="succmsg"></span></p>
             </div>
@@ -47,18 +46,22 @@
             <div class="ui icon message">
                 <i class="yellow exclamation circle icon"></i>
                 <div class="content">
-                    <div class="header">
-                        Restart / Shutdown is risky
-                    </div>
-                    <p>If you decided to shutdown your host server, ArozOS will pass the shutdown sequence to the host operating system and there is no way to know from the web interface if the shutdown / restart process has completed. <br>
-                        <b>Please make sure you are shutting it down in a location where you can physcically power on the host again.</b></p>
+                    <div class="header" locale="hostPower/restart_shutdown_risk">Restart / Shutdown is risky</div>
+                    <p locale="hostPower/shutdown_warning">If you decide to shutdown your host server, ArozOS will pass the shutdown sequence to the host operating system and there is no way to know from the web interface if the shutdown / restart process has completed. <br>
+                        <b locale="hostPower/ensure_safety">Please make sure you are shutting it down in a location where you can physically power on the host again.</b></p>
                 </div>
             </div>
-            
         </div>
+        
         <script>
             $("#lastupdateTime").text(ao_module_utils.timeConverter(Date.now()/1000));
 
+            var powerLocale = NewAppLocale();
+            powerLocale.init("../locale/system_info_power.json", function(){
+                powerLocale.translate();
+                handleConnectionStateCheck();
+            });
+            
             function shutdown(){
                 var apiObject = {
                     api: "system/power/shutdown",
@@ -122,7 +125,7 @@
                 }
             }
 
-            handleConnectionStateCheck();
+            
             setTimeout(function(){
                 handleConnectionStateCheck();
             }, 3000)
@@ -134,7 +137,7 @@
                         data: {},
                         success: function(){
                             //Online
-                            $("#sysConnState").text("System Online");
+                            $("#sysConnState").text(powerLocale.getString("hostPower/status/online","System Online"));
                             $("#lastupdateTime").text(ao_module_utils.timeConverter(Date.now()/1000));
                             $("#sysConnStateIcon").attr("class","green check circle icon");
 
@@ -144,7 +147,7 @@
                         },
                         error: function(){
                             //Timeout
-                            $("#sysConnState").text("Disconnected");
+                            $("#sysConnState").text(powerLocale.getString("hostPower/status/disconnected", "Disconnected"));
                             $("#lastupdateTime").text(ao_module_utils.timeConverter(Date.now()/1000));
                             $("#sysConnStateIcon").attr("class","yellow exclamation circle icon");
                             setTimeout(function(){

+ 60 - 0
web/SystemAO/locale/system_info_power.json

@@ -0,0 +1,60 @@
+{
+    "author": "tobychui",
+    "version": "1.0",
+    "keys": {
+        "zh-tw": {
+            "name": "繁體中文(台灣)",
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
+            "strings":{
+                "hostPower/host_power": "主機電源",
+                "hostPower/host_power_title": "主機電源",
+                "hostPower/change_power_state": "更改設備的電源狀態",
+                "hostPower/system_online": "系統在線",
+                "hostPower/last_update": "上次更新時間:",
+                "hostPower/power_options": "電源選項",
+                "hostPower/power_off": "關機",
+                "hostPower/restart": "重新啟動",
+                "hostPower/restart_shutdown_risk": "重新啟動/關機具有風險",
+                "hostPower/shutdown_warning": "如果您決定關閉主機服務器,ArozOS 將把關機信號發送給主機作業系統,從 Web 介面並無法知道關機/重新啟動過程是否已完成。<br><b>請確保將其關閉時您是位于可以在物理上重新啟動主機的地方。</b>",
+                "hostPower/ensure_safety": "請確保您在可以物理上重新啟動主機的地方進行關機。",
+                "hostPower/status/online": "系統在線",
+                "hostPower/status/disconnected": "已離線",
+                "":""
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        },
+        "zh-hk": {
+            "name": "繁體中文(香港)",
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
+            "strings":{
+                
+                "":""
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        },
+        "zh-cn": {
+            "name": "简体中文(简体)",
+            "fwtitle" : "",
+            "strings":{
+                
+                "":""
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        }
+    }
+}

+ 102 - 0
web/SystemAO/locale/system_info_runtime.json

@@ -0,0 +1,102 @@
+{
+    "author": "tobychui",
+    "version": "1.0",
+    "keys": {
+        "zh-tw": {
+            "name": "繁體中文(台灣)",
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
+            "strings":{
+                "runtime/runtime_adjustment": "即時執行環境調整",
+                "runtime/update_system_startup_parameters": "在運行時更新系統啟動參數",
+                "runtime/host_name": "伺服器名稱",
+                "runtime/max_upload_size": "最大上傳大小(MB)",
+                "runtime/file_upload_buffer": "文件上傳緩衝區(MB)",
+                "runtime/file_io_buffer": "文件 IO 緩衝區(位元組,預設 1024)",
+                "runtime/disable_ip_resolver": "禁用 IP 解析器",
+                "runtime/disable_ip_resolver_note": "不嘗試分析客戶端 IP 地址,在服務器位於 NAT 或反向代理下時有用",
+                "runtime/enable_home_page": "啟用首頁",
+                "runtime/enable_home_page_note": "允許用戶託管自己的靜態網頁",
+                "runtime/enable_directory_listing": "啟用目錄列表",
+                "runtime/enable_directory_listing_note": "如果請求 URL 是資料夾,則允許列出目錄的內容",
+                "runtime/confirmation_message": "繼續更新您的啟動配置,請確認:",
+                "runtime/i_know_what_i_am_doing": "我確定我知道在做什麼",
+                "runtime/i_know_what_i_am_doing_note": "這些設置僅會應用在當前的執行環境。如果出現問題,您可以重新啟動系統以恢復到預設值。",
+                "runtime/write_to_runtime": "寫入當前執行環境",
+                "runtime/update_failed": "參數更新失敗",
+                "runtime/param_updated": "啟動參數已更新",
+                "runtime/param_updated_note": "這些設置僅會應用在當前的執行環境。重新啟動您的服務器以恢復到預設值。",
+                "":""
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        },
+        "zh-hk": {
+            "name": "繁體中文(香港)",
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
+            "strings":{
+                "runtime/runtime_adjustment": "即時執行環境調整",
+                "runtime/update_system_startup_parameters": "在運行時更新系統啟動參數",
+                "runtime/host_name": "伺服器名稱",
+                "runtime/max_upload_size": "最大上傳大小(MB)",
+                "runtime/file_upload_buffer": "文件上傳緩衝區(MB)",
+                "runtime/file_io_buffer": "文件 IO 緩衝區(位元組,預設 1024)",
+                "runtime/disable_ip_resolver": "禁用 IP 解析器",
+                "runtime/disable_ip_resolver_note": "不嘗試分析客戶端 IP 地址,在服務器位於 NAT 或反向代理下時有用",
+                "runtime/enable_home_page": "啟用首頁",
+                "runtime/enable_home_page_note": "允許用戶託管自己的靜態網頁",
+                "runtime/enable_directory_listing": "啟用目錄列表",
+                "runtime/enable_directory_listing_note": "如果請求 URL 是資料夾,則允許列出目錄的內容",
+                "runtime/confirmation_message": "繼續更新您的啟動配置,請確認:",
+                "runtime/i_know_what_i_am_doing": "我確定我知道在做什麼",
+                "runtime/i_know_what_i_am_doing_note": "這些設置僅會應用在當前的執行環境。如果出現問題,您可以重新啟動系統以恢復到預設值。",
+                "runtime/write_to_runtime": "寫入當前執行環境",
+                "runtime/update_failed": "參數更新失敗",
+                "runtime/param_updated": "啟動參數已更新",
+                "runtime/param_updated_note": "這些設置僅會應用在當前的執行環境。重新啟動您的服務器以恢復到預設值。",
+                "":""
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        },
+        "zh-cn": {
+            "name": "简体中文(简体)",
+            "fwtitle" : "",
+            "strings":{
+                "runtime/runtime_adjustment": "即时执行环境调整",
+                "runtime/update_system_startup_parameters": "在运行时更新系统启动参数",
+                "runtime/host_name": "伺服器名称",
+                "runtime/max_upload_size": "最大上传大小(MB)",
+                "runtime/file_upload_buffer": "文件上传缓冲区(MB)",
+                "runtime/file_io_buffer": "文件 IO 缓冲区(位元组,预设 1024)",
+                "runtime/disable_ip_resolver": "禁用 IP 解析器",
+                "runtime/disable_ip_resolver_note": "不尝试分析客户端 IP 地址,在服务器位于 NAT 或反向代理下时有用",
+                "runtime/enable_home_page": "启用首页",
+                "runtime/enable_home_page_note": "允许用户托管自己的静态网页",
+                "runtime/enable_directory_listing": "启用目录列表",
+                "runtime/enable_directory_listing_note": "如果请求 URL 是资料夹,则允许列出目录的内容",
+                "runtime/confirmation_message": "继续更新您的启动配置,请确认:",
+                "runtime/i_know_what_i_am_doing": "我确定我知道在做什么",
+                "runtime/i_know_what_i_am_doing_note": "这些设置仅会应用在当前的执行环境。如果出现问题,您可以重新启动系统以恢复到预设值。",
+                "runtime/write_to_runtime": "写入当前执行环境",
+                "runtime/update_failed": "参数更新失败",
+                "runtime/param_updated": "启动参数已更新",
+                "runtime/param_updated_note": "这些设置仅会应用在当前的执行环境。重新启动您的服务器以恢复到预设值。",
+                "":""
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        }
+    }
+}