Selaa lähdekoodia

Added desktop localization

TC pushbot 5 4 vuotta sitten
vanhempi
commit
ae6b2ac5bf

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

@@ -1474,7 +1474,7 @@
                 if (ao_module_virtualDesktop){
                     var tmp = path.split("/");
                     tmp.pop();
-                    ao_module_setWindowTitle("File Manager - " + tmp.pop());
+                    ao_module_setWindowTitle(applocale.getString("title/title", "File Manager") + " - " + tmp.pop());
                 }
                 //Check if there are parent path for curret path
                 if (checkIfParentDirExists(currentPath)){

+ 37 - 23
web/SystemAO/file_system/file_properties.html

@@ -1,37 +1,44 @@
 <html>
     <head>
-        <title>File Properties</title>
+        <title locale="title/title">File Properties</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.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>
             body{
                 overflow:hidden;
             }
 
+            @font-face {
+                font-family: 'TaipeiSansTCBeta-Regular';
+                src: url('../../script/font/TaipeiSansTCBeta-Regular.ttf');
+            }
+            h1, h2, h3, p, span, div,span { font-family: 'TaipeiSansTCBeta-Regular',"Lucida Console", "Courier New", monospace;}
+
         </style>
     </head>
     <body id="filePropertiesWindow">
         <br>
         <div class="ui container">
             <h3 class="ui header">
-                File Properties
-                <div class="sub header">Basic File Information</div>
+                <span locale="title/title">File Properties</span>
+                <div class="sub header" locale="title/desc">Basic File Information</div>
             </h3>
             <div class="ui divider"></div>
             <div id="properties">
 
             </div>
             <br>
-            <button style="display:none;" class="ui small blue fluid button singleFileOnly" onclick="changeDefaultWebApp();">Change Default WebApp</button>
-            <button style="margin-top: 4px;" class="ui small fluid button linuxonly" onclick="openFilePermissionPanel();">Change File Permissions</button>
+            <button style="display:none;" class="ui small blue fluid button singleFileOnly" onclick="changeDefaultWebApp();" locale="button/changeDefault">Change Default WebApp</button>
+            <button style="margin-top: 4px;" class="ui small fluid button linuxonly" onclick="openFilePermissionPanel();" locale="button/changeFilePermission">Change File Permissions</button>
             <br>
         </div>
         <div id="filesizeLoader" class="ui active dimmer">
-            <div class="ui indeterminate text loader">Calculating File Size</div>
+            <div class="ui indeterminate text loader" locale="loader/loadingFileSize">Calculating File Size</div>
         </div>
         <script>
             //Initiate the view model
@@ -55,7 +62,12 @@
                 }
             }
 
-            initFileProperties();
+            applocale.init("../locale/file_properties.json", function(){
+                applocale.translate();
+                initFileProperties();
+            });
+
+           
           
 
             //Hide windows / linux only operations
@@ -114,9 +126,9 @@
                         filecount++;
                     }
                 }
-                $("#properties").append(ui_getText("Multiple selections"));
-                $("#properties").append(ui_getText(filecount + " Files"));
-                $("#properties").append(ui_getText(foldercount + " Folders"));
+                $("#properties").append(ui_getText(applocale.getString("selection/multi", "Multiple selections")));
+                $("#properties").append(ui_getText(filecount + applocale.getString("counter/files", " Files")));
+                $("#properties").append(ui_getText(foldercount + applocale.getString("counter/folders", " Folders")));
 
                 //Append other properties as table
                 $("#properties").append(ui_getTable(
@@ -278,7 +290,11 @@
                 for (var i =0; i < table.length; i++){
                     html += `<tr>`;
                     for (var j =0; j < table[i].length; j++){
-                        html += `<td style="word-break: break-all;">${table[i][j]}</td>`
+                        var keyString = table[i][j];
+                        if (j == 0 && applocale){
+                            keyString = applocale.getString("properties/key/" + keyString.trim(), keyString);
+                        }
+                        html += `<td style="word-break: break-all;">${keyString}</td>`
                     }
                     html += `</tr>`;
                 }
@@ -357,8 +373,6 @@
             */
 
             function generateDisplayLastModTime(lastModTime){
-                console.log(lastModTime);
-
                 //Try to split the date into js date format
                 var dateInfo = (lastModTime.split(" ")[0]).split("-");
                 var modTime = new Date(dateInfo[0],dateInfo[1],dateInfo[2]);
@@ -366,32 +380,32 @@
                 var displayText = "Unknown";
                 if (diff[2] > 0){
                     //years
-                    displayText = diff[2] + " year";
+                    displayText = diff[2] + applocale.getString("lastmod/time/year", " year");
                     if (diff[2] > 1){
-                        displayText += "s"
+                        displayText += applocale.getString("lastmod/time/s", "s")
                     }
 
-                    displayText += " ago";
+                    displayText += applocale.getString("lastmod/time/ago", " ago");
                     
                 }else if (diff[1] > 0){
                     //months
-                    displayText = diff[1] + "  month";
+                    displayText = diff[1] +  applocale.getString("lastmod/time/month", "  month");
                     if (diff[1] > 1){
-                        displayText += "s"
+                        displayText += applocale.getString("lastmod/time/s", "s")
                     }
 
-                    displayText += " ago";
+                    displayText += applocale.getString("lastmod/time/ago", " ago");
                 }else if (diff [0] > 0){
                     //days
-                    displayText = diff[0] + "  day";
+                    displayText = diff[0] + applocale.getString("lastmod/time/days", "  day");
                     if (diff[0] > 1){
-                        displayText += "s"
+                        displayText += applocale.getString("lastmod/time/s", "s");
                     }
 
-                    displayText += " ago";
+                    displayText += applocale.getString("lastmod/time/ago", " ago");
                 }else{
                     //just now
-                    displayText = "Today"
+                    displayText = applocale.getString("lastmod/time/today", "Today");
                 }
 
                 return displayText + " (" + lastModTime + ")";

+ 85 - 0
web/SystemAO/locale/desktop.json

@@ -0,0 +1,85 @@
+{
+    "author": "tobychui",
+    "version": "1.0",
+    "keys": {
+        "zh-TW": {
+            "strings":{
+                "topbar/welcome":"歡迎回來",
+                "topbar/arozos":"ArozOS 網頁桌面模式",
+
+                "notification/clear": "全部清除",
+                "notification/nonotification":"沒有通知",
+
+                "listmenu/catergory/searchResults": "搜尋結果",
+                "listmenu/catergory/all": "全部",
+                "listmenu/catergory/media": "媒體",
+                "listmenu/catergory/office": "辦工",
+                "listmenu/catergory/download": "下載",
+                "listmenu/catergory/files": "檔案",
+                "listmenu/catergory/internet": "網絡",
+                "listmenu/catergory/settings": "設定",
+                "listmenu/catergory/tools": "系統程式",
+                "listmenu/catergory/utils": "附屬程式",
+                "listmenu/catergory/other": "其他",
+                "listmenu/catergory/exit": "登出",
+
+                "error/connlost/title": "連線中斷",
+                "error/connlost":"與伺服器的連線中斷。請等待此警告牌消失再作進一步操作",
+                "error/connlost/recheck":"重試",
+                "error/connlost/wait":"等待",
+
+                "quickAccess/logout": "登出",
+                "quickAccess/sysvol":"系統音量",
+                "quickAccess/settings":"系統設定",
+                "quickAccess/fullscreen":"切換全螢幕",
+                "quickAccess/restart":"重新啟動伺服器",
+                "quickAccess/poweroff":"關機伺服器",
+
+                "contextmenu/New": "新增",
+                "contextmenu/Open": "開啟",
+                "contextmenu/Open With": "使用 … 開啟",
+                "contextmenu/Download in Zip": "壓縮並下載",
+                "contextmenu/Make a Copy": "製作複本",
+                "contextmenu/Delete": "刪除",
+                "contextmenu/Properties": "內容",
+                "contextmenu/Share": "分享",
+                "contextmenu/Download": "下載",
+                "contextmenu/Rename": "重新命名",
+                "contextmenu/Zip here": "壓縮至此",
+                "contextmenu/Open in New Tab": "在新分頁開啟",
+                "contextmenu/Download as Zip": "壓縮並下載",
+                "contextmenu/Refresh": "重新整理",
+                "contextmenu/Open File Manager": "開啟檔案管理員",
+                "contextmenu/Open File Location": "開啟檔案位置",
+                "contextmenu/Personalization": "風格個人化",
+                "contextmenu/Background": "桌面背景",
+                "contextmenu/Icon Size": "圖標大小",
+                "contextmenu/Exit": "登出",
+                "contextmenu/Toggle FullScreen": "切換全螢幕",
+                "contextmenu/Minimize": "最小化",
+                "contextmenu/Restore": "還原大小",
+                "contextmenu/Maximize": "最大化",
+                "contextmenu/Close": "關閉",
+                "contextmenu/Select Other WebApps": "選擇預設應用程式",
+                "contextmenu/Open Shared Link": "開啟分享連接",
+                "contextmenu/Copy Link": "複製連結",
+                "contextmenu/Change Share Settings": "更改分享設定",
+                "contextmenu/Share this File": "分享此檔案",
+                "contextmenu/share/link": "任何擁有連接的使用者",
+                "contextmenu/share/signedin": "任何已登入的使用者",
+                "contextmenu/share/samegroup": "擁有相同權限的使用者",
+                "contextmenu/Remove Share": "移除檔案分享",
+                "contextmenu/Small": "小",
+                "contextmenu/Medium": "中",
+                "contextmenu/Big": "大",
+                "contextmenu/Folder": "資料夾",
+                "contextmenu/Shortcut": "捷徑",
+
+                "":""
+            },
+            "placeholder":{
+                "Search": "搜尋"
+            }
+        }
+    }
+}

+ 2 - 1
web/SystemAO/locale/file_explorer.json

@@ -4,6 +4,7 @@
     "keys": {
         "zh-TW": {
             "strings": {
+                "title/title": "檔案管理員",
                 "menu/button/download": "下載所選",
                 "menu/sort/asc": "檔名順序",
                 "menu/sort/desc": "檔名倒序",
@@ -100,7 +101,7 @@
                 "contextmenu/paste": "貼上",
                 "contextmenu/cut": "剪下",
                 "contextmenu/newFile": "新增檔案",
-                "contextmenu/newFolder": "創建資料夾",
+                "contextmenu/newFolder": "新增資料夾",
                 "contextmenu/upload": "上載",
                 "contextmenu/zip": "建立壓縮檔",
                 "contextmenu/rename": "重新命名",

+ 43 - 0
web/SystemAO/locale/file_properties.json

@@ -0,0 +1,43 @@
+{
+    "author": "tobychui",
+    "version": "1.0",
+    "keys": {
+        "zh-TW": {
+            "fwtitle" : "檔案內容",
+            "strings": {
+                "title/title":"檔案內容",
+                "title/desc": "檔案基本內容及描述",
+
+                "properties/key/Default WebApp": "預設開啟應用",
+                "properties/key/Virtual Path": "虛擬存取路徑",
+                "properties/key/Storage Path": "磁碟儲存路徑",
+                "properties/key/File Size": "檔案大小",
+                "properties/key/Folder Size": "資料夾大小",
+                "properties/key/Permission": "存取權限",
+                "properties/key/Last Modified": "最後修改",
+                "properties/key/File Type": "檔案類型",
+                "properties/key/Owner": "擁有者",
+                "properties/key/Total Size": "總共大小",
+                "properties/key/Virtual Directory": "虛擬存放位置",
+                "properties/key/Storage Directory": "磁碟存放位置",
+
+                "lastmod/time/year": " 年",
+                "lastmod/time/month": " 個月",
+                "lastmod/time/days": " 日",
+                "lastmod/time/today": "今天",
+                "lastmod/time/s": "",
+                "lastmod/time/ago": "前",
+
+                "button/changeDefault":"更改預設啟動應用",
+                "button/changeFilePermission":"更改檔案存取權限",
+                "loader/loadingFileSize": "正在計算檔案大小",
+                "selection/multi": "已選擇多個檔案",
+
+                "counter/files": " 個檔案",
+                "counter/folders": " 個資料夾",
+
+                "":""
+            }
+        }
+    }
+}

+ 137 - 106
web/desktop.system

@@ -11,6 +11,7 @@
     <script type="text/javascript" src="./script/jquery.min.js"></script>
     <script type="text/javascript" src="./script/ao_module.js"></script>
     <script type="text/javascript" src="./SystemAO/desktop/script/jsCalendar/source/jsCalendar.js"></script>
+    <script type="text/javascript" src="./script/applocale.js"></script>
     <style>
         body {
             background-repeat: no-repeat;
@@ -821,10 +822,10 @@
             <div id="notificationlist" style="width: calc(100% - 302px); padding:8px; margin-top:5px; padding-top:22px; overflow-y:auto; overflow-x:hidden; height: calc(100% - 12px);">
                 <div class="nonotification">
                     <h4 class="ts center aligned icon header">
-                        <i class="bell icon"></i>No Notification
+                        <i class="bell icon"></i><span locale="notification/nonotification">No Notification</span>
                     </h4>
                 </div>
-                <a class="clearall" onclick="clearAllNotification();">Clear All</a>
+                <a class="clearall" onclick="clearAllNotification();" locale="notification/clear">Clear All</a>
             </div>
             <div style="position:absolute; right:3px; top:3px; padding-top:8px;">
                 <div class="ts header" style="padding-left:22px;">
@@ -871,19 +872,19 @@
         </div>
         <dib class="listItemWrapper">
             <div class="groups">
-                <div id="searchResults" class="item" style="display:none;">Search Results</div>
-                <div class="item groupType selected" group="All">All</div>
-                <div class="item groupType" group="Media">Media</div>
-                <div class="item groupType" group="Office">Office</div>
-                <div class="item groupType" group="Download">Download</div>
-                <div class="item groupType" group="Files">Files</div>
-                <div class="item groupType" group="Internet">Internet</div>
-                <div class="item groupType" group="System Settings">System Settings</div>
-                <div class="item groupType" group="System Tools">System Tools</div>
-                <div class="item groupType" group="Utilities">Utilities</div>
-                <div class="item groupType" group="Other">Other</div>
+                <div locale="listmenu/catergory/searchResults" id="searchResults" class="item" style="display:none;">Search Results</div>
+                <div locale="listmenu/catergory/all" class="item groupType selected" group="All">All</div>
+                <div locale="listmenu/catergory/media" class="item groupType" group="Media">Media</div>
+                <div locale="listmenu/catergory/office" class="item groupType" group="Office">Office</div>
+                <div locale="listmenu/catergory/download" class="item groupType" group="Download">Download</div>
+                <div locale="listmenu/catergory/files" class="item groupType" group="Files">Files</div>
+                <div locale="listmenu/catergory/internet" class="item groupType" group="Internet">Internet</div>
+                <div locale="listmenu/catergory/settings" class="item groupType" group="System Settings">System Settings</div>
+                <div locale="listmenu/catergory/tools" class="item groupType" group="System Tools">System Tools</div>
+                <div locale="listmenu/catergory/utils" class="item groupType" group="Utilities">Utilities</div>
+                <div locale="listmenu/catergory/other" class="item groupType" group="Other">Other</div>
                 <div class="poweroption">
-                    <img id="powerIcon" style="width:18px; vertical-align: top; margin-right:4px;" src="img/system/power.svg"></img> Exit
+                    <img id="powerIcon" style="width:18px; vertical-align: top; margin-right:4px;" src="img/system/power.svg"></img> <span locale="listmenu/catergory/exit">Exit</span>
                 </div>
             </div>
             <div id="listMenuItem" class="items">
@@ -905,14 +906,14 @@
     <div id="connectionLost">
         <div class="ts inverted card themeColor" style="width: 300px; background-color: rgba(14,14,14,0.5);">
             <div class="content">
-                <div class="header"><img class="ts mini image blink-image" style="vertical-align:bottom; padding-right: 0.5em;" src="SystemAO/desktop/icons/connlost.svg"> Connection Lost</div>
-                <div class="description">
+                <div class="header"><img class="ts mini image blink-image" style="vertical-align:bottom; padding-right: 0.5em;" src="SystemAO/desktop/icons/connlost.svg" locale="error/connlost/title"> Connection Lost</div>
+                <div class="description" locale="error/connlost">
                     Connection to server is lost. Please wait until this warning disappear before further operations.
                 </div>
             </div>
             <div class="ts fluid bottom attached buttons">
-                <button class="ts opinion button" onclick="handleManualCheckReconnect(this);">Check Again</button>
-                <button class="ts secondary opinion button">Wait</button>
+                <button locale="error/connlost/recheck" class="ts opinion button" onclick="handleManualCheckReconnect(this);">Check Again</button>
+                <button locale="error/connlost/wait" class="ts secondary opinion button">Wait</button>
             </div>
         </div>
         
@@ -933,30 +934,30 @@
                 </div>
                 <div class="actions">
                     <div class="ts button" onclick="logout(); hideToolPanel();">
-                        <i class="log out icon"></i> Logout
+                        <i class="log out icon"></i> <span locale="quickAccess/logout">Logout</span>
                     </div>
                 </div>
             </div>
         </div>
         <div class="item" style="padding-bottom:12px;">
-            <i class="volume up icon"></i> System Global Volume
+            <i class="volume up icon"></i> <span locale="quickAccess/sysvol">System Global Volume</span>
             <div class="ts fluid small progress" style="margin-top:8px; cursor:pointer;" onclick="updateVolume(this,event);" >
                 <div id="volumebar" class="bar" style="width: 0%; background-color:#52C9FF;  cursor:pointer;"></div>
             </div>
         </div>
         <div class="item" id="settingButton" onclick="showSystemSettings(); hideToolPanel();" ontouchend="showSystemSettings(); hideToolPanel();">
-            <i class="setting icon"></i> System Settings
+            <i class="setting icon"></i> <span locale="quickAccess/settings">System Settings</span>
             <!-- <div style="float:right;"><i class="caret right icon"></i></div> -->
         </div>
         <div class="item" onclick="fullscreen(); hideToolPanel();" ontouchend="fullscreen(); hideToolPanel();">
-            <i class="maximize icon"></i> Toggle Fullscreen
+            <i class="maximize icon"></i> <span locale="quickAccess/fullscreen">Toggle Fullscreen</span>
         </div>
         <div class="ts divider"></div>
         <div class="item hardware" onclick="restart(); hideToolPanel();" ontouchend="restart(); hideToolPanel();">
-            <i class="repeat icon"></i> Restart
+            <i class="repeat icon"></i> <span locale="quickAccess/restart">Restart</span>
         </div>
         <div class="item hardware" style="color:#b51d1d;"  onclick="shutdown(); hideToolPanel();" ontouchend="shutdown(); hideToolPanel();">
-            <i class="power icon"></i> Power Off
+            <i class="power icon"></i> <span locale="quickAccess/poweroff">Power Off</span>
         </div>
     </div>
 
@@ -1041,25 +1042,44 @@
         var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
         var isMacOS = (navigator.appVersion.indexOf("Mac")!=-1);
 
-        //Initiation functions
-        initDesktopTheme();
-        initDesktopHostInfo();
-        initDesktopUserInfo();
-        initBackgroundSwitchingAnimation();
-        //Commented for debug purpose
-        initUploadMode();
-        initModuleList();
-        initDesktopIconPreference()
-        initUserDefinedThemeColor();
-        hookFloatWindowEvents();
-        hookLaunchMenuEvents();
-        initTheme();
-        initStartupSounds();
-
-        //Login cookie expire check
-        setInterval(function() {
-            checkConnection();
-        }, 15000);
+        //Check and prepare localization
+        if (applocale){
+            //Applocale found. Do localization
+            applocale.init("./SystemAO/locale/desktop.json", function(){
+                applocale.translate();
+                initDesktop();
+            });
+        }else{
+            //Applocale not found. Is this a trim down version of ArozOS?
+            var applocale = {
+                getString: function(key, original){
+                    return original;
+                }
+            }
+            initDesktop();
+        }
+
+        function initDesktop(){
+            //Initiation functions
+            initDesktopTheme();
+            initDesktopHostInfo();
+            initDesktopUserInfo();
+            initBackgroundSwitchingAnimation();
+            //Commented for debug purpose
+            initUploadMode();
+            initModuleList();
+            initDesktopIconPreference()
+            initUserDefinedThemeColor();
+            hookFloatWindowEvents();
+            hookLaunchMenuEvents();
+            initTheme();
+            initStartupSounds();
+
+            //Login cookie expire check
+            setInterval(function() {
+                checkConnection();
+            }, 15000);
+        }
 
         function handleManualCheckReconnect(button){
             $(button).addClass("loading");
@@ -4176,63 +4196,63 @@
                     //Check if selected more than one object
                     if ($(".launchIconWrapper.selected").length > 1){
                             //When the user selected more than one item on desktop
-                            addContextMenuItem($("#contextmenu"), 'Open', undefined, "openIconViaMenu", false);
-                            addContextMenuItem($("#contextmenu"), 'Open With', "<i class='caret right icon'></i>", "handleOpenWith", true);
+                            addContextMenuItem($("#contextmenu"), lcontex('Open'), undefined, "openIconViaMenu", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Open With'), "<i class='caret right icon'></i>", "handleOpenWith", true);
                             //addContextMenuItem($("#contextmenu"), 'Share', "<i class='caret right icon'></i>", "handleFileShare", true);
                             addContextMenuSeperator($("#contextmenu"));
-                            addContextMenuItem($("#contextmenu"), 'Download in Zip', "<i class='download icon'></i>", "downloadFile", false);
-                            addContextMenuItem($("#contextmenu"), 'Make a Copy', "<i class='copy icon'></i>", "handleCloning", false);
-                            addContextMenuItem($("#contextmenu"), 'Delete', "<i class='trash icon'></i>", "handleFileDelete", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Download in Zip'), "<i class='download icon'></i>", "downloadFile", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Make a Copy'), "<i class='copy icon'></i>", "handleCloning", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Delete'), "<i class='trash icon'></i>", "handleFileDelete", false);
                             addContextMenuSeperator($("#contextmenu"));
-                            addContextMenuItem($("#contextmenu"), 'Properties', undefined, "openObjectProperty", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Properties'), undefined, "openObjectProperty", false);
 
                     }else{
                         //When the user only selected one item
                         if (objectType == "file") {
-                            addContextMenuItem($("#contextmenu"), 'Open', undefined, "openIconViaMenu", false);
-                            addContextMenuItem($("#contextmenu"), 'Open With', "<i class='caret right icon'></i>", "handleOpenWith", true);
-                            addContextMenuItem($("#contextmenu"), 'Share', "<i class='caret right icon'></i>", "handleFileShare", true);
+                            addContextMenuItem($("#contextmenu"), lcontex('Open'), undefined, "openIconViaMenu", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Open With'), "<i class='caret right icon'></i>", "handleOpenWith", true);
+                            addContextMenuItem($("#contextmenu"), lcontex('Share'), "<i class='caret right icon'></i>", "handleFileShare", true);
                             addContextMenuSeperator($("#contextmenu"));
-                            addContextMenuItem($("#contextmenu"), 'Download', "<i class='download icon'></i>", "downloadFile", false);
-                            addContextMenuItem($("#contextmenu"), 'Make a Copy', "<i class='copy icon'></i>", "handleCloning", false);
-                            addContextMenuItem($("#contextmenu"), 'Rename', undefined, "handleRename", false);
-                            addContextMenuItem($("#contextmenu"), 'Delete', "<i class='trash icon'></i>", "handleFileDelete", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Download'), "<i class='download icon'></i>", "downloadFile", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Make a Copy'), "<i class='copy icon'></i>", "handleCloning", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Rename'), undefined, "handleRename", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Delete'), "<i class='trash icon'></i>", "handleFileDelete", false);
                             addContextMenuSeperator($("#contextmenu"));
-                            addContextMenuItem($("#contextmenu"), 'Properties', undefined, "openObjectProperty", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Properties'), undefined, "openObjectProperty", false);
 
                         } else if (objectType == "folder") {
-                            addContextMenuItem($("#contextmenu"), 'Open', undefined, "openIconViaMenu", false);
-                            addContextMenuItem($("#contextmenu"), 'Zip here', "<i class='zip icon'></i>", "handleZipFolder", false);
-                            addContextMenuItem($("#contextmenu"), 'Share', "<i class='caret right icon'></i>", "handleFileShare", true);
+                            addContextMenuItem($("#contextmenu"), lcontex('Open'), undefined, "openIconViaMenu", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Zip here'), "<i class='zip icon'></i>", "handleZipFolder", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Share'), "<i class='caret right icon'></i>", "handleFileShare", true);
                             addContextMenuSeperator($("#contextmenu"));
-                            addContextMenuItem($("#contextmenu"), 'Download as Zip', "<i class='download icon'></i>", "downloadFile", false);
-                            addContextMenuItem($("#contextmenu"), 'Make a Copy', "<i class='caret right icon'></i>", "handleCloning", false);
-                            addContextMenuItem($("#contextmenu"), 'Rename', undefined, "handleRename", false);
-                            addContextMenuItem($("#contextmenu"), 'Delete', "<i class='trash icon'></i>", "handleFileDelete", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Download as Zip'), "<i class='download icon'></i>", "downloadFile", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Make a Copy'), "<i class='caret right icon'></i>", "handleCloning", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Rename'), undefined, "handleRename", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Delete'), "<i class='trash icon'></i>", "handleFileDelete", false);
                             addContextMenuSeperator($("#contextmenu"));
-                            addContextMenuItem($("#contextmenu"), 'Properties', undefined, "openObjectProperty", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Properties'), undefined, "openObjectProperty", false);
                         } else if (objectType == "shortcut") {
                             var fd = JSON.parse(decodeURIComponent($(clickTarget).attr("filedata")));
                             console.log(fd);
                             if (fd.ShortcutType == "module"){
                                 //Public WebApp
-                                addContextMenuItem($("#contextmenu"), 'Open', undefined, "openIconViaMenu", false);
-                                addContextMenuItem($("#contextmenu"), 'Open in New Tab', "<i class='external icon'></i>", "openWebAppInNewTab", false);
-                                addContextMenuItem($("#contextmenu"), 'Rename', undefined, "handleRename", false);
-                                addContextMenuItem($("#contextmenu"), 'Delete', "<i class='trash icon'></i>", "handleFileDelete", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Open'), undefined, "openIconViaMenu", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Open in New Tab'), "<i class='external icon'></i>", "openWebAppInNewTab", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Rename'), undefined, "handleRename", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Delete'), "<i class='trash icon'></i>", "handleFileDelete", false);
 
                             }else if (fd.ShortcutType == "folder"){
                                 //Folder
-                                addContextMenuItem($("#contextmenu"), 'Open', undefined, "openIconViaMenu", false);
-                                addContextMenuItem($("#contextmenu"), 'Open File Location', "<i class='folder open icon'></i>", "handleShortcutFolderOpen", false);
-                                addContextMenuItem($("#contextmenu"), 'Rename', undefined, "handleRename", false);
-                                addContextMenuItem($("#contextmenu"), 'Delete', "<i class='trash icon'></i>", "handleFileDelete", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Open'), undefined, "openIconViaMenu", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Open File Location'), "<i class='folder open icon'></i>", "handleShortcutFolderOpen", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Rename'), undefined, "handleRename", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Delete'), "<i class='trash icon'></i>", "handleFileDelete", false);
                                 addContextMenuSeperator($("#contextmenu"));
-                                addContextMenuItem($("#contextmenu"), 'Properties', undefined, "openObjectProperty", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Properties'), undefined, "openObjectProperty", false);
                           
                             }else{
-                                addContextMenuItem($("#contextmenu"), 'Open', undefined, "openIconViaMenu", false);
-                                addContextMenuItem($("#contextmenu"), 'Delete', "<i class='trash icon'></i>", "handleFileDelete", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Open'), undefined, "openIconViaMenu", false);
+                                addContextMenuItem($("#contextmenu"), lcontex('Delete'), "<i class='trash icon'></i>", "handleFileDelete", false);
                             }
                             
                           
@@ -4244,34 +4264,34 @@
 
                 } else if (clickTarget.hasClass("backgroundFrame") || ((isSafari || (isMacOS && isChrome)) && $(clickTarget).attr("id") == "selectionPanel")) {
                     //Click on the background. Load background context menu.
-                    addContextMenuItem($("#contextmenu"), 'New', "<i class='caret right icon'></i>", "newitemmenu", true);
-                    addContextMenuItem($("#contextmenu"), 'Refresh', "<i class='refresh icon'></i>", "handleMenuRefresh", false);
-                    addContextMenuItem($("#contextmenu"), 'Open File Manager', undefined, "openfm", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('New'), "<i class='caret right icon'></i>", "newitemmenu", true);
+                    addContextMenuItem($("#contextmenu"), lcontex('Refresh'), "<i class='refresh icon'></i>", "handleMenuRefresh", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Open File Manager'), undefined, "openfm", false);
                     //addContextMenuItem($("#contextmenu"), 'Get File from URL', "<i class='download icon'></i>", "downloadURL", false);
-                    addContextMenuItem($("#contextmenu"), 'Personalization', "<i class='paint brush icon'></i>", "personalization", false);
-                    addContextMenuItem($("#contextmenu"), 'Background', "<i class='caret right icon'></i>", "background", true);
-                    addContextMenuItem($("#contextmenu"), 'Icon Size', "<i class='caret right icon'></i>", "listIconsize", true);
-                    addContextMenuItem($("#contextmenu"), 'Toggle FullScreen', "<i class='maximize icon'></i>", "fullscreen", false);
-                    addContextMenuItem($("#contextmenu"), 'Exit', undefined, "logout", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Personalization'), "<i class='paint brush icon'></i>", "personalization", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Background'), "<i class='caret right icon'></i>", "background", true);
+                    addContextMenuItem($("#contextmenu"), lcontex('Icon Size'), "<i class='caret right icon'></i>", "listIconsize", true);
+                    addContextMenuItem($("#contextmenu"), lcontex('Toggle FullScreen'), "<i class='maximize icon'></i>", "fullscreen", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Exit'), undefined, "logout", false);
                     showMenu = true;
                 }else if (clickTarget.hasClass("fwdragger") || (clickTarget.hasClass("title") && clickTarget.parent().hasClass("fwdragger"))){
                     //Click on the floatWindow object 
-                    addContextMenuItem($("#contextmenu"), 'Open in New Tab', "<i class='external icon'></i>", "openSelectedFloatWindowInNewTab", false);
-                    addContextMenuItem($("#contextmenu"), 'Refresh', "<i class='refresh icon'></i>", "refreshSelectedFloatWindow", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Open in New Tab'), "<i class='external icon'></i>", "openSelectedFloatWindowInNewTab", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Refresh'), "<i class='refresh icon'></i>", "refreshSelectedFloatWindow", false);
                     addContextMenuSeperator($("#contextmenu"));
-                    addContextMenuItem($("#contextmenu"), 'Minimize', "<i class='window minimize icon'></i>", "minimizeSelectedFloatWindow", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Minimize'), "<i class='window minimize icon'></i>", "minimizeSelectedFloatWindow", false);
 
                     if ($(clickTarget).parent().hasClass("fixedsize") == false && $(clickTarget).parent().parent().hasClass("fixedsize") == false){
                         //This FloatWindow is resizable
                         console.log($(clickTarget).parent());
                         if ($(clickTarget).parent().attr("max") !== undefined && $(clickTarget).parent().attr("max") == "true"){
-                            addContextMenuItem($("#contextmenu"), 'Restore', "<i class='window window restore icon'></i>", "maximizeSelectedFloatWindow", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Restore'), "<i class='window window restore icon'></i>", "maximizeSelectedFloatWindow", false);
                         }else{
-                            addContextMenuItem($("#contextmenu"), 'Maximize', "<i class='window maximize icon'></i>", "maximizeSelectedFloatWindow", false);
+                            addContextMenuItem($("#contextmenu"), lcontex('Maximize'), "<i class='window maximize icon'></i>", "maximizeSelectedFloatWindow", false);
                         }
                         
                     }
-                    addContextMenuItem($("#contextmenu"), 'Close', "<i class='remove icon'></i>", "closeSelectedFloatWindow", false);
+                    addContextMenuItem($("#contextmenu"), lcontex('Close'), "<i class='remove icon'></i>", "closeSelectedFloatWindow", false);
                     showMenu = true;
                 }
 
@@ -4294,8 +4314,17 @@
                     });
                     menuStartLocation = [e.pageX, e.pageY];
                 }
-                
-            }, true);
+            }
+        , true);
+        
+        //Localize context menu items using applocale
+        function lcontex(key){
+            if (applocale){
+                return applocale.getString("contextmenu/" + key, key);
+            }else{
+                return key;
+            }
+        }
 
         function handleMenuRefresh() {
             //This function is here to remove the object and event passed in from menu pressed object
@@ -4336,6 +4365,8 @@
                     }
                 });
             });
+
+            hideAllContextMenus();
         }
 
         function downloadFile(target, event){
@@ -4451,7 +4482,7 @@
 
                     //Add select more opener option
                     addContextMenuSeperator($("#subcontextmenu"));
-                    addContextMenuItem($("#subcontextmenu"), "Select Other WebApps", ``, "openOpenSelector", false);
+                    addContextMenuItem($("#subcontextmenu"), lcontex("Select Other WebApps"), ``, "openOpenSelector", false);
                 }
                 showSubContextMenu(target);
             });
@@ -4470,20 +4501,20 @@
                      data: {path: fileData.Filepath},
                      success: function(data){
                         if (data.IsShared == true){
-                            addContextMenuItem($("#subcontextmenu"), "Open Shared Link", `<i class="external icon"></i>`, "openSharedLink", false, {
+                            addContextMenuItem($("#subcontextmenu"), lcontex("Open Shared Link"), `<i class="external icon"></i>`, "openSharedLink", false, {
                                 payload: {
                                     uuid: data.ShareUUID.UUID
                                 }
                             });
-                            addContextMenuItem($("#subcontextmenu"), "Copy Link", `<i class="copy icon"></i>`, "copySharedLink", false, {
+                            addContextMenuItem($("#subcontextmenu"),  lcontex("Copy Link"), `<i class="copy icon"></i>`, "copySharedLink", false, {
                                 payload: {
                                     uuid: data.ShareUUID.UUID
                                 }
                             });
                             addContextMenuSeperator($("#subcontextmenu"));
-                            addContextMenuTitle($("#subcontextmenu"), `<i class="share alternate icon"></i> Change Share Settings`);
+                            addContextMenuTitle($("#subcontextmenu"), lcontex(`<i class="share alternate icon"></i> ${applocale.getString("contextmenu/Change Share Settings", "Change Share Settings")}]`));
                         }else{
-                            addContextMenuTitle($("#subcontextmenu"), `<i class="share alternate icon"></i> Share this File`);
+                            addContextMenuTitle($("#subcontextmenu"), lcontex(`<i class="share alternate icon"></i> ${applocale.getString("contextmenu/Share this File", "Share this File")}`));
                         }
 
                         var checkmarkStyle = `style="color: #71ba68;"`;
@@ -4501,17 +4532,17 @@
                             samegroup = `<i ${checkmarkStyle} class="checkmark icon"></i>`;
                         }
 
-                        addContextMenuItem($("#subcontextmenu"), `<i class="globe icon"></i> Anyone with Link`, anyoneClass, "shareWithThisPermission", false, {
+                        addContextMenuItem($("#subcontextmenu"), `<i class="globe icon"></i> ${applocale.getString("contextmenu/share/link","Anyone with Link")}`, anyoneClass, "shareWithThisPermission", false, {
                             payload: {
                                 type: "anyone"
                             }
                         });
-                        addContextMenuItem($("#subcontextmenu"), `<i class="user circle outline icon"></i> Anyone Signed In`, signedinClass, "shareWithThisPermission", false, {
+                        addContextMenuItem($("#subcontextmenu"), `<i class="user circle outline icon"></i> ${applocale.getString( "contextmenu/share/signedin","Anyone Signed In")}`, signedinClass, "shareWithThisPermission", false, {
                             payload: {
                                 type: "signedin"
                             }
                         });
-                        addContextMenuItem($("#subcontextmenu"), `<i class="users icon"></i> Same Group Users`, sameGroupClass, "shareWithThisPermission", false,{
+                        addContextMenuItem($("#subcontextmenu"), `<i class="users icon"></i> ${applocale.getString("contextmenu/share/samegroup","Same Group Users")}`, sameGroupClass, "shareWithThisPermission", false,{
                             payload: {
                                 type: "samegroup"
                             }
@@ -4519,7 +4550,7 @@
                         if (data.IsShared == true){
                             //This file is shared.
                             addContextMenuSeperator($("#subcontextmenu"));
-                            addContextMenuItem($("#subcontextmenu"), "Remove Share", `<i style="color: #d97762;" class="trash icon"></i>`, "shareWithThisPermission", false,{
+                            addContextMenuItem($("#subcontextmenu"), lcontex("Remove Share"), `<i style="color: #d97762;" class="trash icon"></i>`, "shareWithThisPermission", false,{
                                 payload: {
                                     type: "remove"
                                 }
@@ -4774,9 +4805,9 @@
             if (desktopIconSize == "big") {
                 bigCheckmark = "<i class='checkmark icon'></i>";
             }
-            addContextMenuItem($("#subcontextmenu"), "Small", smallCheckmark, "setDesktopIconSize", false);
-            addContextMenuItem($("#subcontextmenu"), "Medium", mediumCheckmark, "setDesktopIconSize", false);
-            addContextMenuItem($("#subcontextmenu"), "Big", bigCheckmark, "setDesktopIconSize", false);
+            addContextMenuItem($("#subcontextmenu"), lcontex("Small"), smallCheckmark, "setDesktopIconSize", false);
+            addContextMenuItem($("#subcontextmenu"), lcontex("Medium"), mediumCheckmark, "setDesktopIconSize", false);
+            addContextMenuItem($("#subcontextmenu"), lcontex("Big"), bigCheckmark, "setDesktopIconSize", false);
             showSubContextMenu(target);
         }
 
@@ -5078,8 +5109,8 @@
         function newitemmenu(target, event) {
             $("#subcontextmenu").html("");
             //Append the new folder option first
-            addContextMenuItem($("#subcontextmenu"), 'Folder', "<i class='folder icon'></i>", "newfolder", true);
-            addContextMenuItem($("#subcontextmenu"), 'Shortcut', "<i class='external icon'></i>", "newshortcut", true);
+            addContextMenuItem($("#subcontextmenu"), lcontex('Folder'), "<i class='folder icon'></i>", "newfolder", true);
+            addContextMenuItem($("#subcontextmenu"), lcontex('Shortcut'), "<i class='external icon'></i>", "newshortcut", true);
             addContextMenuSeperator($("#subcontextmenu"));
             requestCSRFToken(function(token){
                 $.ajax({

+ 6 - 1
web/script/applocale.js

@@ -17,7 +17,7 @@
 */
 
 
-let applocale = {
+var applocale = {
     lang: navigator.language,
     localeFile: "",
     localData: {},
@@ -31,6 +31,11 @@ let applocale = {
                 if (callback != undefined){
                     callback(data);
                 }
+
+                if (data.keys[applocale.lang] != undefined && data.keys[applocale.lang].fwtitle != undefined && ao_module_virtualDesktop){
+                    //Update the floatwindow title as well
+                    ao_module_setWindowTitle(data.keys[applocale.lang].fwtitle);
+                }
             }
           });
     },