[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - ios/Mobile ios/Mobile.xcodeproj
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Mar 4 14:40:33 UTC 2019
ios/Mobile.xcodeproj/project.pbxproj | 6 +++++
ios/Mobile/L10n.h | 13 +++++++++++
ios/Mobile/L10n.mm | 28 +++++++++++++++++++++++++
ios/Mobile/TemplateCollectionViewController.mm | 7 +++---
4 files changed, 51 insertions(+), 3 deletions(-)
New commits:
commit 84570cc0b3261bebe5d903e81be665efee70c062
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Dec 13 16:02:04 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 4 15:40:14 2019 +0100
Adapt to LibreOfficeKitClass no longer having the translateGet() method
This is a somewhat temporary quick solution. It bluntly uses the same
code here that I had added for a while as the implementation of
translateGet() for LibreOfficeKitClass in LO core.
Ideally we should have a script here in online to pick the needed
translation from the translations submodule of core and keep them
around even if a translation happens to evaporate from
core/translations. The same idea as in the scripts/unocommands.py, but
I did not yet start modifying or copying that.
Change-Id: I455ad6044e321ef59873d60f8e5f3e7032f2447e
Reviewed-on: https://gerrit.libreoffice.org/68322
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj
index 5f5252c6e..7fcce4ae4 100644
--- a/ios/Mobile.xcodeproj/project.pbxproj
+++ b/ios/Mobile.xcodeproj/project.pbxproj
@@ -63,6 +63,7 @@
BEA2835D21498AD400848631 /* Socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA2835C21498AD400848631 /* Socket.cpp */; };
BEA28360214ACA8500848631 /* FakeSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA2835F214ACA8500848631 /* FakeSocket.cpp */; };
BEA28377214FFD8C00848631 /* Unit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA28376214FFD8C00848631 /* Unit.cpp */; };
+ BEFB1EE121C29CC70081D757 /* L10n.mm in Sources */ = {isa = PBXBuildFile; fileRef = BEFB1EE021C29CC70081D757 /* L10n.mm */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -552,6 +553,8 @@
BEB6524E216FD0CA00B8C09A /* stream.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = stream.cxx; path = "../../ios-device/tools/source/stream/stream.cxx"; sourceTree = "<group>"; };
BEB6524F216FD0CA00B8C09A /* strmwnt.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = strmwnt.cxx; path = "../../ios-device/tools/source/stream/strmwnt.cxx"; sourceTree = "<group>"; };
BEB65250216FD0CA00B8C09A /* strmunx.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = strmunx.cxx; path = "../../ios-device/tools/source/stream/strmunx.cxx"; sourceTree = "<group>"; };
+ BEFB1EDF21C29CC70081D757 /* L10n.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = L10n.h; sourceTree = "<group>"; };
+ BEFB1EE021C29CC70081D757 /* L10n.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = L10n.mm; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -1081,6 +1084,8 @@
BE8D77312136762500AC58EA /* DocumentViewController.mm */,
BE8D77332136762500AC58EA /* Document.h */,
BE8D77342136762500AC58EA /* Document.mm */,
+ BEFB1EDF21C29CC70081D757 /* L10n.h */,
+ BEFB1EE021C29CC70081D757 /* L10n.mm */,
BE80E45C21B6CEF100859C97 /* TemplateSectionHeaderView.h */,
BE80E45D21B6CEF200859C97 /* TemplateSectionHeaderView.m */,
BE80E45621B68F5000859C97 /* TemplateCollectionViewController.h */,
@@ -1457,6 +1462,7 @@
BE80E45E21B6CEF200859C97 /* TemplateSectionHeaderView.m in Sources */,
BE5EB5C3213FE29900E0826C /* Session.cpp in Sources */,
BE5EB5D22140039100E0826C /* LOOLWSD.cpp in Sources */,
+ BEFB1EE121C29CC70081D757 /* L10n.mm in Sources */,
BE5EB5C6213FE29900E0826C /* SigUtil.cpp in Sources */,
BE5EB5C1213FE29900E0826C /* Log.cpp in Sources */,
BE5EB5DA2140363100E0826C /* ios.mm in Sources */,
diff --git a/ios/Mobile/L10n.h b/ios/Mobile/L10n.h
new file mode 100644
index 000000000..ce0c50d3e
--- /dev/null
+++ b/ios/Mobile/L10n.h
@@ -0,0 +1,13 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*-
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#define _(id, catalog) app_translate(id, catalog)
+
+char *app_translate(const char *id, const char *catalog);
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/Mobile/L10n.mm b/ios/Mobile/L10n.mm
new file mode 100644
index 000000000..3f232c361
--- /dev/null
+++ b/ios/Mobile/L10n.mm
@@ -0,0 +1,28 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*-
+//
+// This file is part of the LibreOffice project.
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#import <cstring>
+
+#define LIBO_INTERNAL_ONLY
+
+#import <i18nlangtag/languagetag.hxx>
+#import <unotools/resmgr.hxx>
+
+#import "AppDelegate.h"
+#import "L10n.h"
+
+char* app_translate(const char *id, const char *catalog)
+{
+ LanguageTag tag(OUString::fromUtf8([app_locale UTF8String]));
+ std::locale locale = Translate::Create(catalog, tag);
+ OUString result = Translate::get(id, locale);
+
+ return strdup(result.toUtf8().getStr());
+}
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/Mobile/TemplateCollectionViewController.mm b/ios/Mobile/TemplateCollectionViewController.mm
index cdb6de60d..ca2890e3d 100644
--- a/ios/Mobile/TemplateCollectionViewController.mm
+++ b/ios/Mobile/TemplateCollectionViewController.mm
@@ -12,6 +12,7 @@
#import <LibreOfficeKit/LibreOfficeKitInit.h>
#import "AppDelegate.h"
+#import "L10n.h"
#import "TemplateCollectionViewController.h"
#import "TemplateSectionHeaderView.h"
@@ -96,11 +97,11 @@ static NSString *mapTemplateExtensionToActual(NSString *templateName) {
char *translatedHeader;
if (index == 0)
- translatedHeader = kit->pClass->translateGet(kit, STR_DESCRIPTION_FACTORY_WRITER, "svt", [app_locale UTF8String]);
+ translatedHeader = _(STR_DESCRIPTION_FACTORY_WRITER, "svt");
else if (index == 1)
- translatedHeader = kit->pClass->translateGet(kit, STR_DESCRIPTION_FACTORY_CALC, "svt", [app_locale UTF8String]);
+ translatedHeader = _(STR_DESCRIPTION_FACTORY_CALC, "svt");
else if (index == 2)
- translatedHeader = kit->pClass->translateGet(kit, STR_DESCRIPTION_FACTORY_IMPRESS, "svt", [app_locale UTF8String]);
+ translatedHeader = _(STR_DESCRIPTION_FACTORY_IMPRESS, "svt");
else
abort();
More information about the Libreoffice-commits
mailing list