[Libreoffice-commits] online.git: loleaflet/src

Andras Timar (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 29 14:35:02 UTC 2019


 loleaflet/src/control/Control.Menubar.js |   12 +++++++++++-
 loleaflet/src/control/Toolbar.js         |   16 ++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 092af8e809f246c40089f7aaf25a2631b3bfe96e
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Fri Nov 29 15:32:09 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Nov 29 15:34:37 2019 +0100

    Use special Mac key names on Mac clients with localized keyboards, too
    
    According to vcl/unx/generic/app/keysymnames.cxx and actual translations
    in online, there are only a few exceptions, that can be hardcoded.
    
    Change-Id: Ibaa9399ecb2657e0286327da53a69d3c23cde836

diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index aab4eabb6..dee207243 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -1131,7 +1131,17 @@ L.Control.Menubar = L.Control.extend({
 			var self = this;
 			var msg = _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>');
 			if (navigator.appVersion.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Mac') != -1) {
-				msg = msg.replace(/Ctrl/g, '\u2318');
+				var ctrl = /Ctrl/g;
+				if (String.locale.startsWith('de') || String.locale.startsWith('dsb') || String.locale.startsWith('hsb')) {
+					ctrl = /Strg/g;
+				}
+				if (String.locale.startsWith('lt')) {
+					ctrl = /Vald/g;
+				}
+				if (String.locale.startsWith('sl')) {
+					ctrl = /Krmilka/g;
+				}
+				msg = msg.replace(ctrl, '\u2318');
 			}
 			vex.dialog.alert({
 				unsafeMessage: msg,
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index be8e8dbcf..65a74ecef 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -311,11 +311,23 @@ L.Map.include({
 
 					// Special Mac key names
 					if (navigator.appVersion.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Mac') != -1) {
+						var ctrl = /Ctrl/g;
+						var alt = /Alt/g;
+						if (String.locale.startsWith('de') || String.locale.startsWith('dsb') || String.locale.startsWith('hsb')) {
+							ctrl = /Strg/g;
+						}
+						if (String.locale.startsWith('lt')) {
+							ctrl = /Vald/g;
+						}
+						if (String.locale.startsWith('sl')) {
+							ctrl = /Krmilka/gi;
+							alt = /Izmenjalka/gi;
+						}
 						if (id === 'keyboard-shortcuts') {
-							document.getElementById('keyboard-shortcuts').innerHTML = document.getElementById('keyboard-shortcuts').innerHTML.replace(/Ctrl/g, '⌘').replace(/Alt/g, '⌥');
+							document.getElementById('keyboard-shortcuts').innerHTML = document.getElementById('keyboard-shortcuts').innerHTML.replace(ctrl, '⌘').replace(alt, '⌥');
 						}
 						if (id === 'online-help') {
-							document.getElementById('online-help').innerHTML = document.getElementById('online-help').innerHTML.replace(/Ctrl/g, '⌘').replace(/Alt/g, '⌥');
+							document.getElementById('online-help').innerHTML = document.getElementById('online-help').innerHTML.replace(ctrl, '⌘').replace(alt, '⌥');
 						}
 					}
 


More information about the Libreoffice-commits mailing list