[Libreoffice-commits] online.git: android/lib loleaflet/js loleaflet/Makefile.am loleaflet/util
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 11 10:49:56 UTC 2019
android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 7 +++++++
loleaflet/Makefile.am | 8 +++-----
loleaflet/js/global.js | 9 +++------
loleaflet/util/create-l10n-all-js.pl | 2 ++
4 files changed, 15 insertions(+), 11 deletions(-)
New commits:
commit 0cd43ead59be4ac7efc6b17cf2bc537f48ca3576
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Dec 11 11:46:52 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Dec 11 11:49:37 2019 +0100
android: Make the localization work for the JS pieces.
To have the menu translated.
Change-Id: I8d4d90d260aa3fcd80a8eb68515b22c58c9b3e18
Reviewed-on: https://gerrit.libreoffice.org/84931
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index a9cca125c..a8a9b80ad 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -460,14 +460,21 @@ public class LOActivity extends AppCompatActivity {
// trigger the load of the document
String finalUrlToLoad = "file:///android_asset/dist/loleaflet.html?file_path=" +
urlToLoad + "&closebutton=1";
+
+ // set the language
+ finalUrlToLoad += "&lang=" + getResources().getConfiguration().locale.toLanguageTag();
+
if (isDocEditable) {
finalUrlToLoad += "&permission=edit";
} else {
finalUrlToLoad += "&permission=readonly";
}
+
if (isDocDebuggable) {
finalUrlToLoad += "&debug=true";
}
+
+ // load the page
mWebView.loadUrl(finalUrlToLoad);
documentLoaded = true;
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index e829b9956..410e7453e 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -3,13 +3,11 @@ L10N_PO = $(wildcard $(srcdir)/po/*.po)
if !ENABLE_MOBILEAPP
L10N_JSON = $(patsubst $(srcdir)/po/%.po,$(builddir)/dist/l10n/%.json,$(L10N_PO))
-endif
-
-if ENABLE_IOSAPP
+else
L10N_IOS_ALL_JS = $(builddir)/dist/l10n-all.js
L10N_JSON = $(L10N_IOS_ALL_JS)
-$(L10N_IOS_ALL_JS) : $(wildcard $(srcdir)/po/ui-*.po) $(shell find $(srcdir)/l10n -name '*.*')
+$(L10N_IOS_ALL_JS) : $(wildcard $(srcdir)/po/ui-*.po) $(shell find $(srcdir)/l10n -name '*.*') $(srcdir)/util/create-l10n-all-js.pl
for F in $(wildcard $(srcdir)/po/ui-*.po); do \
$(srcdir)/util/po2json.py $$F -o $$F.json; \
done
@@ -34,7 +32,7 @@ LOLEAFLET_IMAGES_CUSTOM_SRC = $(shell find $(CUSTOM_ICONS_DIRECTORY) -name '*.*'
LOLEAFLET_IMAGES_CUSTOM_DST = $(patsubst $(CUSTOM_ICONS_DIRECTORY)/%,$(builddir)/dist/images/%,$(LOLEAFLET_IMAGES_CUSTOM_SRC))
LOLEAFLET_L10N_SRC = $(shell find $(srcdir)/l10n -name '*.*')
-if !ENABLE_IOSAPP
+if !ENABLE_MOBILEAPP
LOLEAFLET_L10N_DST = $(patsubst $(srcdir)/l10n/%,$(builddir)/dist/l10n/%,$(LOLEAFLET_L10N_SRC))
endif
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index bb751a76b..b582afd16 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -83,7 +83,7 @@
global._ = function (string) {
// In the mobile app case we can't use the stuff from l10n-for-node, as that assumes HTTP.
- if (window.ThisIsTheiOSApp) {
+ if (window.ThisIsAMobileApp) {
// We use another approach just for iOS for now.
if (window.LOCALIZATIONS.hasOwnProperty(string)) {
// window.postMobileDebug('_(' + string + '): YES: ' + window.LOCALIZATIONS[string]);
@@ -96,9 +96,6 @@
// window.postMobileDebug('_(' + string + '): NO');
return string;
}
- } else if (window.ThisIsAMobileApp) {
- // And bail out without translations on other mobile platforms.
- return string;
} else {
return string.toLocaleString();
}
@@ -138,7 +135,7 @@
var lang = global.getParameterByName('lang');
global.queueMsg = [];
- if (window.ThisIsTheiOSApp)
+ if (window.ThisIsAMobileApp)
window.LANG = lang;
if (global.socket && global.socket.readyState !== 3) {
global.socket.onopen = function () {
@@ -149,7 +146,7 @@
global.socket.send('loolclient ' + ProtocolVersionNumber);
- if (window.ThisIsTheiOSApp) {
+ if (window.ThisIsAMobileApp) {
msg += ' lang=' + window.LANG;
} else {
diff --git a/loleaflet/util/create-l10n-all-js.pl b/loleaflet/util/create-l10n-all-js.pl
index 22307a987..949ff3421 100644
--- a/loleaflet/util/create-l10n-all-js.pl
+++ b/loleaflet/util/create-l10n-all-js.pl
@@ -42,6 +42,8 @@ if (underscore > 0) {
if (false) {
;
+} else if (onlylang == 'cs') {
+ window.LOCALIZATIONS = " . insert('cs') . ";
} else if (onlylang == 'da') {
window.LOCALIZATIONS = " . insert('da') . ";
} else if (onlylang == 'de') {
More information about the Libreoffice-commits
mailing list