Toby Chui 3 лет назад
Родитель
Сommit
2cb7708dea

+ 2 - 2
web/SystemAO/file_system/file_explorer.html

@@ -5005,8 +5005,8 @@
                             $("#folderList").show();
                             $("#folderList").html(`<div class="ts basic segment ${currentTheme}">
                                 <div class="ts header ${currentTheme}">
-                                    <i class="question icon" ${currentTheme}></i> <span class="${currentTheme}">No Matching Results</span>
-                                    <div class="sub header ${currentTheme}">The host return no matching results for your keyword "${keyword}". <br>Check your spelling and if your wildcard are valid.</div>
+                                    <i class="question icon" ${currentTheme}></i> <span class="${currentTheme}">${applocale.getString("message/noMatchResults","No Matching Results")}</span>
+                                    <div class="sub header ${currentTheme}">${applocale.getString("message/noMatchResultsDesc","The host return no matching results for your keyword")} "${keyword}". <br>${applocale.getString("message/noMatchResultsInst","Check your spelling and your wildcard characters.")}</div>
                                 </div>
                             </div>`);
                         }else{

+ 38 - 21
web/SystemAO/file_system/file_share.html

@@ -15,31 +15,31 @@
                 <div class="width: 100%; ">
                     <div style="display: block; margin-left: auto; margin-right: auto;" align="center">
                         <div id="qrcode" style="border: 10px solid white; background-color: white;">
-                            <h1>Loading</h1>
+                            <h1><br><i class="ui loading spinner icon"></i><br></h1>
                         </div>
                     </div>
                     <div style="width: 100%">
-                        <a id="sharelink" href="" target="_blank" style="margin-top:8px; font-size: 120%; padding-left: 20px; padding-right: 20px; word-break: break-all; overflow-wrap: anywhere;">Scan this QR Code to copy the share link</a>
+                        <a id="sharelink" href="" target="_blank" style="margin-top:8px; font-size: 120%; padding-left: 20px; padding-right: 20px; word-break: break-all; overflow-wrap: anywhere;"></a>
                     </div>
                     
                 </div>
             </div>
             <div id="shareSettingOptions" class="eight wide column" style="padding-left: 12px; display:none;">
                 <div class="ui header whiteTheme">
-                    Share Settings
-                    <div class="sub header whiteTheme">Change who can see this file</div>
+                    <span locale="share/setting/title">Share Settings</span>
+                    <div class="sub header whiteTheme" locale="share/setting/subtitle">Change who can see this file</div>
                 </div>
                 <div id="shareSettingForm" class="ui form">
                     <div class="field">
-                        <label><p class="whiteTheme">Visable options:</p></label>
+                        <label><p class="whiteTheme" locale="share/setting/options">Visable options:</p></label>
                         <div class="ui checkboxes">
                             <div class="ui radio checkbox">
                                 <input id="anyone" type="radio" class="shareoption" name="shareopt" value="anyone" onchange="updateSharePermission(this);">
                                 <label for="anyone">
                                     <div class="ui header">
                                         <div class="content whiteTheme">
-                                            <i class="globe icon"></i> Anyone with the link
-                                            <div class="sub header whiteTheme">Anyone who has the link can access this file</div>
+                                            <i class="globe icon"></i> <span locale="share/setting/anyoneWithLink">Anyone with the link</span>
+                                            <div class="sub header whiteTheme" locale="share/setting/anyoneWithLink/desc">Anyone who has the link can access this file</div>
                                         </div>
                                     </div>
                                 </label>
@@ -50,8 +50,8 @@
                                 <label for="signedin">
                                     <div class="ui header">
                                         <div class="content whiteTheme">
-                                            <i class="user circle outline icon"></i> Anyone signed in
-                                            <div class="sub header whiteTheme">Anyone who has signed in can access this file</div>
+                                            <i class="user circle outline icon"></i> <span locale="share/setting/anyoneSignedIn">Anyone signed in</span>
+                                            <div class="sub header whiteTheme" locale="share/setting/anyoneSignedIn/desc">Anyone who has signed in can access this file</div>
                                         </div>
                                     </div>
                                 </label>
@@ -62,15 +62,15 @@
                                 <label for="samegroup">
                                     <div class="ui header">
                                         <div class="content whiteTheme">
-                                            <i class="users icon"></i> Users in the same group
-                                            <div class="sub header whiteTheme">Anyone who is in the same group as you do</div>
+                                            <i class="users icon"></i> <span locale="share/setting/sameGroup">Users in the same group</span>
+                                            <div class="sub header whiteTheme" locale="share/setting/sameGroup/desc">Anyone who is in the same group as you do</div>
                                         </div>
                                     </div>
                                 </label>
                             </div>
                         <br><br>
                         <div id="udpateNotification" style="display:none;" class="ui green inverted segment">
-                                <i class=" checkmark icon"></i> Share Setting Updated
+                                <i class=" checkmark icon"></i> <span locale="share/setting/updated">Share Setting Updated</span>
                         </div>
                         </div>
                     </div>
@@ -80,10 +80,10 @@
         <div class="ui divider"></div>
         <div style="width: 100%; padding-right: 12px;" align="right">
             <div class="ui button popupbuttons whiteTheme allowHover" onclick="copyLinkToClipboard(this)">
-                <i class="copy icon"></i> Copy
+                <i class="copy icon"></i> <span locale="button/copy">Copy</span>
             </div> 
             <div id="sharingRemoveBtn" class="ui red button popupbuttons negative whiteTheme allowHover" onclick="removeSharing()">
-                <i class="remove icon"></i> Remove
+                <i class="remove icon"></i> <span locale="button/remove">Remove</span>
             </div> 
         </div>
         <script>
@@ -112,12 +112,18 @@
             var shareingFileData = {};
             var initialized = false;
             var fileSharingURL = "";
+            
 
             function PageReady(){
                 if (initialized){
                     return;
                 }
                 initialized = true;
+                //Do localization
+                applocale.init(relpath + "../SystemAO/locale/file_share.json", function(){
+                    applocale.translate();
+                });
+
                 $(".checkbox").checkbox();
                 var inputFile = ao_module_loadInputFiles();
                 if (inputFile == null){
@@ -145,7 +151,7 @@
                         //As the share mode is defined by the caller, hide the setting interface
                         $("#shareSettingOptions").hide();
                         $.ajax({
-                            url: "../../system/file_system/share/edit",
+                            url: relpath + "../system/file_system/share/edit",
                             data: {uuid: shareEditingUUID, mode: shareingFileData.shareMode},
                             success: function(data){
                                 if (data.error !== undefined){
@@ -169,11 +175,12 @@
                         $("#shareSettingOptions").show();
                     }
                 });
+
             }
 
             function initFileDetails(shareingFileData, callback=undefined){
                 $.ajax({
-                    url: "../../system/file_system/share/new",
+                    url: relpath + "../system/file_system/share/new",
                     data: {path: shareingFileData.filepath},
                     success: function(data){
                         if (data.error !== undefined){
@@ -216,7 +223,7 @@
 
                 //The target file to remove
                 $.ajax({
-                    url: "../../system/file_system/share/delete",
+                    url: relpath + "../system/file_system/share/delete",
                     data: {path: shareingFileData.filepath},
                     success: function(data){
                         if (data.error !== undefined){
@@ -227,7 +234,7 @@
                             $(".checkbox").addClass("disabled");
                             $("#sharelink").text("");
                             $("#sharelink").attr("href", "#");
-                            $("#qrcode").html(`<br><br><h1><i class="green checkmark icon"></i> Share Removed</h1>`);
+                            $("#qrcode").html(`<br><br><h1><i class="green checkmark icon"></i> ${applocale.getString("message/removed", "Share Removed")}</h1>`);
 
                             //If the file is located on desktop and it is web desktop mode
                             if (ao_module_virtualDesktop == true){
@@ -247,7 +254,7 @@
             function updateSharePermission(object){
                 var newPermission = $(object).attr('value');
                 $.ajax({
-                    url: "../../system/file_system/share/edit",
+                    url: relpath + "../system/file_system/share/edit",
                     data: {uuid: shareEditingUUID, mode: newPermission},
                     success: function(data){
                         if (data.error !== undefined){
@@ -265,7 +272,12 @@
                 if (location.protocol !== 'https:') {
                     protocol = "http://";
                 }
-                var shareURL = protocol + window.location.hostname + ":" + window.location.port + "/share/" + uuid;
+
+                var port = ":" + window.location.port;
+                if (window.location.port == ""){
+                    port = "";
+                }
+                var shareURL = protocol + window.location.hostname + port + "/share/" + uuid;
                 shareEditingUUID = uuid;
                 fileSharingURL = shareURL;
                 new QRCode(document.getElementById("qrcode"), shareURL);
@@ -317,6 +329,11 @@
                 script.setAttribute('src', relpath + "qrcode.min.js");
                 document.getElementsByTagName('head')[0].appendChild(script);
 
+                //Inject applocale
+                script = document.createElement('script');
+                script.setAttribute('src', relpath + "applocale.js");
+                document.getElementsByTagName('head')[0].appendChild(script);
+
                 //Inject semmantic css and js anyway
                 var head  = document.getElementsByTagName('head')[0];
                 var link  = document.createElement('link');
@@ -385,7 +402,7 @@
 
                 //Do visual feedback
                 let oldContent = $(btn).html();
-                $(btn).html(`<i class="green checkmark icon"></i> Copied!`);
+                $(btn).html(`<i class="green checkmark icon"></i> ${applocale.getString("button/copied","Copied!")}`);
                 setTimeout(function(){
                     $(btn).html(oldContent);
                 }, 3000);

+ 11 - 0
web/SystemAO/locale/file_explorer.json

@@ -154,6 +154,9 @@
                 "message/User not logged in":"使用者未登入",
                 "message/Folder not exists":"找不到資料夾",
 
+                "message/noMatchResults":"找不到匹配的檔案",
+                "message/noMatchResultsDesc":"伺服器找不到與此關鍵字匹配的檔案",
+                "message/noMatchResultsInst":"請檢查你的關鍵字或通配符是否正確。",
 
                 "message/destIdentical": "檔案來源及目的地相同",
                 "message/decodeFilelistFail": "載案置入失敗:無法讀取檔案列表",
@@ -348,6 +351,10 @@
                 "message/User not logged in":"使用者未登入",
                 "message/Folder not exists":"找不到資料夾",
 
+                "message/noMatchResults":"找不到匹配的檔案",
+                "message/noMatchResultsDesc":"伺服器找不到與此關鍵字匹配的檔案",
+                "message/noMatchResultsInst":"請檢查你的關鍵字或通配符是否正確。",
+
                 "message/destIdentical": "檔案來源及目的地相同",
                 "message/decodeFilelistFail": "載案置入失敗:無法讀取檔案列表",
                 "message/uploadFailed": "載案上載失敗:檔案太大或目標儲存裝置已滿",
@@ -541,6 +548,10 @@
                 "message/User not logged in":"使用者未登入",
                 "message/Folder not exists":"找不到资料夹", 
 
+                "message/noMatchResults":"找不到匹配的文件",
+                "message/noMatchResultsDesc":"伺服器找不到与此关键字匹配的文件",
+                "message/noMatchResultsInst":"请检查你的关键字或通配符是否正确。", 
+
                 "message/destIdentical": "文件来源及目的地相同",
                 "message/decodeFilelistFail": "载案置入失败:无法读取文件列表",
                 "message/uploadFailed": "载案上传失败:文件太大或目标储存装置已满",

+ 61 - 0
web/SystemAO/locale/file_share.json

@@ -0,0 +1,61 @@
+{
+    "author": "tobychui",
+    "version": "1.0",
+    "keys": {
+        "zh-tw": {
+            "name": "繁體中文(台灣)",
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
+            "fwtitle" : "檔案分享",
+            "strings":{
+                "button/copy":"複製到剪貼簿",
+                "button/remove":"移除分享",
+                "button/copied":"已複製!",
+
+                "share/setting/title":"分享設定",
+                "share/setting/subtitle":"設定誰可以存取此檔案",
+                "share/setting/options":"取存設定:",
+                "share/setting/anyoneWithLink":"擁有連接的使用者",
+                "share/setting/anyoneWithLink/desc":"任何擁有分享連接的使用者皆可下載此檔案",
+                "share/setting/anyoneSignedIn":"已登入的使用者",
+                "share/setting/anyoneSignedIn/desc":"任何已登入並擁有分享連接的使用者皆可下載此檔案",
+                "share/setting/sameGroup":"在同一權限群組內的使用者",
+                "share/setting/sameGroup/desc":"任何擁有相同使用者權限的使用者皆可下載此檔案",
+                "share/setting/updated":"存取權限已更新",
+
+                "message/removed": "分享已移除",
+                "qr/loading": "載入中"
+               
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        },
+        "zh-hk": {
+            "fwtitle" : "",
+            "strings":{
+
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        },
+        "zh-cn": {
+            "fwtitle" : "",
+            "strings":{
+
+            },
+            "titles":{
+
+            },
+            "placeholder":{
+
+            }
+        }
+    }
+}

+ 1 - 0
web/script/applocale.js

@@ -41,6 +41,7 @@ var applocale = {
                     $("h1, h2, h3, p, span, div, span").css({
                         "font-family":data.keys[applocale.lang].fontFamily
                     });
+                    console.log("[Applocale] Updating font family to: ", data.keys[applocale.lang].fontFamily)
                 }
               
             }