[Libreoffice-commits] online.git: 3 commits - Mobile/Mobile Mobile/Mobile.xcodeproj

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 9 23:37:12 UTC 2018


 Mobile/Mobile.xcodeproj/project.pbxproj |    4 ----
 Mobile/Mobile/Document.h                |    1 -
 Mobile/Mobile/Document.mm               |   17 ++++++++++++++---
 Mobile/Mobile/DocumentViewController.mm |    2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 273452d8c68b2b0904d2fd90680db8e39faeed0f
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Sat Nov 10 01:27:11 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Sat Nov 10 01:34:37 2018 +0200

    We don't need the l10n folder in the app bundle
    
    I could not figure out any sane way to access the correct .json files,
    or data constructed from them by the Objective-C code, at run-time in
    the iOS app. The l10n-for-node stuff that gets used in a normal Online
    is not suitable at all as it wants to use XMLHttpRequest.
    
    Thus I am working on changes to loleaflet that will include the
    translations in the bundle.js when building for iOS. (Or Android,
    presumably, once we get there.) There won't be any need to load the
    correct .json files separately.
    
    Change-Id: Ifd72b4077f3634c34dd2c2d84c0a2554459c86b6

diff --git a/Mobile/Mobile.xcodeproj/project.pbxproj b/Mobile/Mobile.xcodeproj/project.pbxproj
index 44796f2f2..5a749f2ab 100644
--- a/Mobile/Mobile.xcodeproj/project.pbxproj
+++ b/Mobile/Mobile.xcodeproj/project.pbxproj
@@ -10,7 +10,6 @@
 		BE00F8A021396585001CE2D4 /* loleaflet.html in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89621396585001CE2D4 /* loleaflet.html */; };
 		BE00F8A121396585001CE2D4 /* bundle.css in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89721396585001CE2D4 /* bundle.css */; };
 		BE00F8A321396585001CE2D4 /* bundle.js in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89921396585001CE2D4 /* bundle.js */; };
-		BE00F8A521396585001CE2D4 /* l10n in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89B21396585001CE2D4 /* l10n */; };
 		BE00F8A621396585001CE2D4 /* loading.html in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89C21396585001CE2D4 /* loading.html */; };
 		BE00F8A721396585001CE2D4 /* loleaflet-help.html in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89D21396585001CE2D4 /* loleaflet-help.html */; };
 		BE00F8A821396585001CE2D4 /* images in Resources */ = {isa = PBXBuildFile; fileRef = BE00F89E21396585001CE2D4 /* images */; };
@@ -66,7 +65,6 @@
 		BE00F89621396585001CE2D4 /* loleaflet.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = loleaflet.html; path = ../../../loleaflet/dist/loleaflet.html; sourceTree = "<group>"; };
 		BE00F89721396585001CE2D4 /* bundle.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = bundle.css; path = ../../../loleaflet/dist/bundle.css; sourceTree = "<group>"; };
 		BE00F89921396585001CE2D4 /* bundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = bundle.js; path = ../../../loleaflet/dist/bundle.js; sourceTree = "<group>"; };
-		BE00F89B21396585001CE2D4 /* l10n */ = {isa = PBXFileReference; lastKnownFileType = folder; name = l10n; path = ../../../loleaflet/dist/l10n; sourceTree = "<group>"; };
 		BE00F89C21396585001CE2D4 /* loading.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = loading.html; path = ../../../loleaflet/dist/loading.html; sourceTree = "<group>"; };
 		BE00F89D21396585001CE2D4 /* loleaflet-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "loleaflet-help.html"; path = "../../../loleaflet/dist/loleaflet-help.html"; sourceTree = "<group>"; };
 		BE00F89E21396585001CE2D4 /* images */ = {isa = PBXFileReference; lastKnownFileType = folder; name = images; path = ../../../loleaflet/dist/images; sourceTree = "<group>"; };
@@ -544,7 +542,6 @@
 				BE00F89721396585001CE2D4 /* bundle.css */,
 				BE00F89921396585001CE2D4 /* bundle.js */,
 				BE00F89E21396585001CE2D4 /* images */,
-				BE00F89B21396585001CE2D4 /* l10n */,
 				BE00F89C21396585001CE2D4 /* loading.html */,
 				BE00F89D21396585001CE2D4 /* loleaflet-help.html */,
 				BE00F89621396585001CE2D4 /* loleaflet.html */,
@@ -1314,7 +1311,6 @@
 				BE00F8A021396585001CE2D4 /* loleaflet.html in Resources */,
 				BE8D85CA214055F3009F1860 /* offapi.rdb in Resources */,
 				BE8D773A2136762600AC58EA /* Assets.xcassets in Resources */,
-				BE00F8A521396585001CE2D4 /* l10n in Resources */,
 				BE8D85CC214055F3009F1860 /* config in Resources */,
 				BE00F8A321396585001CE2D4 /* bundle.js in Resources */,
 				BE8D77382136762500AC58EA /* Main.storyboard in Resources */,
commit 3fb87afb99a399130f4f4f1f7e4791f761c76d6f
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Sat Nov 10 01:26:12 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Sat Nov 10 01:34:37 2018 +0200

    Make the debug messages from our JS stand out better
    
    Change-Id: Id3ee1adf7bb2c4b2a04518243ca089288bc6b062

diff --git a/Mobile/Mobile/DocumentViewController.mm b/Mobile/Mobile/DocumentViewController.mm
index f706af0c5..294851684 100644
--- a/Mobile/Mobile/DocumentViewController.mm
+++ b/Mobile/Mobile/DocumentViewController.mm
@@ -148,7 +148,7 @@
     if ([message.name isEqualToString:@"error"]) {
         LOG_ERR("Error from WebView: " << [message.body UTF8String]);
     } else if ([message.name isEqualToString:@"debug"]) {
-        LOG_DBG([message.body UTF8String]);
+        LOG_TRC_NOFILE("==> " << [message.body UTF8String]);
     } else if ([message.name isEqualToString:@"lool"]) {
         LOG_TRC("To Online: " << [message.body UTF8String]);
 
commit 3cd9218355e40ecc40b06a361e49444390185f1d
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Nov 9 23:33:55 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Sat Nov 10 01:34:37 2018 +0200

    Pass locale as query item to loleaflet.html for future use
    
    Change-Id: I03eebebb3c1d7be223052b936d70b5a7e7c6b5f7

diff --git a/Mobile/Mobile/Document.h b/Mobile/Mobile/Document.h
index f51cb3bac..004bcce0b 100644
--- a/Mobile/Mobile/Document.h
+++ b/Mobile/Mobile/Document.h
@@ -17,7 +17,6 @@
 
 @interface Document : UIDocument {
 @public
-    std::string uri;
     int fakeClientFd;
 }
 
diff --git a/Mobile/Mobile/Document.mm b/Mobile/Mobile/Document.mm
index bbd20d16d..a14871a42 100644
--- a/Mobile/Mobile/Document.mm
+++ b/Mobile/Mobile/Document.mm
@@ -33,13 +33,24 @@
 
 - (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError **)errorPtr {
     fakeClientFd = fakeSocketSocket();
-    uri = [[[self fileURL] absoluteString] UTF8String];
+    NSString *uri = [[self fileURL] absoluteString];
+
+    // Having LANG in the environment is expected to happen only when debugging from Xcode
+    char *lang = std::getenv("LANG");
+    NSString *locale;
+    if (lang != nullptr)
+        locale = [NSString stringWithUTF8String:lang];
+    else
+        locale = [NSLocale currentLocale].languageCode;
 
     NSURL *url = [[NSBundle mainBundle] URLForResource:@"loleaflet" withExtension:@"html"];
     NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
-    components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"file_path" value:[NSString stringWithUTF8String:uri.c_str()]],
+    components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"file_path" value:uri],
                                [NSURLQueryItem queryItemWithName:@"closebutton" value:@"1"],
-                               [NSURLQueryItem queryItemWithName:@"permission" value:@"edit"]];
+                               [NSURLQueryItem queryItemWithName:@"permission" value:@"edit"],
+                               [NSURLQueryItem queryItemWithName:@"lang" value:locale]
+                             ];
+
     NSURLRequest *request = [[NSURLRequest alloc]initWithURL:components.URL];
     [self.viewController.webView loadRequest:request];
 


More information about the Libreoffice-commits mailing list