[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - ios/Mobile
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Mar 4 14:39:39 UTC 2019
ios/Mobile/AppDelegate.h | 5 ++---
ios/Mobile/AppDelegate.mm | 14 +++++++++++---
ios/Mobile/Document.mm | 12 ++----------
3 files changed, 15 insertions(+), 16 deletions(-)
New commits:
commit 442ba898ba4d55e5330f74bab6c94924368f77fc
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Dec 10 19:46:52 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 4 15:39:22 2019 +0100
Fetch the locale already in the AppDelegate's didFinishLaunchingWithOptions
It will be needed by code that runs before the Document object is
created.
Change-Id: I5c4646e08c670b88b6d3a4d38450cc80e11ec402
Reviewed-on: https://gerrit.libreoffice.org/68319
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/ios/Mobile/AppDelegate.h b/ios/Mobile/AppDelegate.h
index b373e8759..cc6d4a629 100644
--- a/ios/Mobile/AppDelegate.h
+++ b/ios/Mobile/AppDelegate.h
@@ -8,14 +8,13 @@
#import <UIKit/UIKit.h>
-//#define LOK_USE_UNSTABLE_API
-//#import <LibreOfficeKit/LibreOfficeKit.h>
-
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
+extern NSString *app_locale;
+
// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/Mobile/AppDelegate.mm b/ios/Mobile/AppDelegate.mm
index 50d4b791d..99cf64d5c 100644
--- a/ios/Mobile/AppDelegate.mm
+++ b/ios/Mobile/AppDelegate.mm
@@ -24,9 +24,7 @@
static LOOLWSD *loolwsd = nullptr;
- at interface AppDelegate ()
-
- at end
+NSString *app_locale;
@implementation AppDelegate
@@ -35,6 +33,16 @@ static LOOLWSD *loolwsd = nullptr;
if (!trace)
trace = strdup("warning");
+ // Having LANG in the environment is expected to happen only when debugging from Xcode. When
+ // testing some language one doesn't know it might be risky to simply set one's iPad to that
+ // language, as it might be hard to find the way to set it back to a known language.
+
+ char *lang = std::getenv("LANG");
+ if (lang != nullptr)
+ app_locale = [NSString stringWithUTF8String:lang];
+ else
+ app_locale = [[NSLocale preferredLanguages] firstObject];
+
Log::initialize("Mobile", trace, false, false, {});
Util::setThreadName("main");
fakeSocketSetLoggingCallback([](const std::string& line)
diff --git a/ios/Mobile/Document.mm b/ios/Mobile/Document.mm
index 241e2cb3d..1a0ccdcde 100644
--- a/ios/Mobile/Document.mm
+++ b/ios/Mobile/Document.mm
@@ -51,22 +51,14 @@
fakeClientFd = fakeSocketSocket();
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 preferredLanguages] firstObject];
-
- comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(OUString::fromUtf8(OString([locale UTF8String])), true));
+ comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(OUString::fromUtf8(OString([app_locale UTF8String])), true));
NSURL *url = [[NSBundle mainBundle] URLForResource:@"loleaflet" withExtension:@"html"];
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"file_path" value:uri],
[NSURLQueryItem queryItemWithName:@"closebutton" value:@"1"],
[NSURLQueryItem queryItemWithName:@"permission" value:@"edit"],
- [NSURLQueryItem queryItemWithName:@"lang" value:locale]
+ [NSURLQueryItem queryItemWithName:@"lang" value:app_locale]
];
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:components.URL];
More information about the Libreoffice-commits
mailing list