[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - comphelper/source configure.ac ios/CustomTarget_iOS_setup.mk lingucomponent/Module_lingucomponent.mk lingucomponent/source postprocess/Rdb_services.mk Repository.mk solenv/bin

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 5 14:51:25 UTC 2021


 Repository.mk                                               |    2 -
 comphelper/source/misc/lok.cxx                              |    2 -
 configure.ac                                                |    4 ---
 ios/CustomTarget_iOS_setup.mk                               |    8 +++++++
 lingucomponent/Module_lingucomponent.mk                     |    2 -
 lingucomponent/source/lingutil/lingutil.cxx                 |   13 +++++++++---
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |    7 +++---
 postprocess/Rdb_services.mk                                 |    2 -
 solenv/bin/native-code.py                                   |    2 -
 9 files changed, 28 insertions(+), 14 deletions(-)

New commits:
commit 8f83c486d324629f3191ec8a528d6ba940e15fe0
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 17 11:50:23 2021 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Apr 5 16:50:49 2021 +0200

    tdf#124909: Use the myspell dictionary for Swiss German on iOS
    
    The iOS system German dictionary is not good for Swiss German. (And it
    doesn't even claim to be, it says it is for de_DE.) The system German
    dictionary accepts 'ß' but that is not used in Swiss German, 'ss' is
    always used instead.
    
    Build the spell library for iOS, too, and don't assume that the system
    de_DE dictionary would be usable for de_CH and de_LI. Copy those
    dictionaries for inclusion in the iOS app bundle.
    
    Change-Id: I0f8020812221024756c792bddc16a707de35b827
    Signed-off-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112603
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112635
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113606

diff --git a/Repository.mk b/Repository.mk
index 9105eea5e29a..049672c2c9b1 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -413,7 +413,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	simplecanvas \
 	slideshow \
 	sot \
-	$(if $(filter-out iOS,$(OS)),spell) \
+	spell \
 	$(if $(DISABLE_GUI),,spl) \
 	storagefd \
 	$(call gb_Helper_optional,SCRIPTING,stringresource) \
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index c2a44872755f..796a3dc3b839 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -210,7 +210,7 @@ bool isAllowlistedLanguage(const OUString& lang)
     if (!isActive())
         return true;
 
-#ifdef ANDROID
+#if defined ANDROID || defined IOS
     (void) lang;
     return true;
 #else
diff --git a/configure.ac b/configure.ac
index 0a9757aab432..71230c077cf0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10753,9 +10753,7 @@ dnl ===================================================================
 dnl Check for system hunspell
 dnl ===================================================================
 AC_MSG_CHECKING([which libhunspell to use])
-if test "$_os" = iOS; then
-   AC_MSG_RESULT([none])
-elif test "$with_system_hunspell" = "yes"; then
+if test "$with_system_hunspell" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_HUNSPELL=TRUE
     AC_LANG_PUSH([C++])
diff --git a/ios/CustomTarget_iOS_setup.mk b/ios/CustomTarget_iOS_setup.mk
index d417be34cfed..95cf79abfe3f 100644
--- a/ios/CustomTarget_iOS_setup.mk
+++ b/ios/CustomTarget_iOS_setup.mk
@@ -76,6 +76,14 @@ $(IOSGEN)/native-code.h: $(BUILDDIR)/config_host.mk \
 	mkdir -p $(IOSRES)/share/fonts
 	cp -R $(INSTDIR)/share/fonts/truetype $(IOSRES)/share/fonts
 	cp -R $(INSTDIR)/share/gallery $(IOSRES)/share
+	mkdir -p $(IOSRES)/share/spell
+	# Install the Swiss German dictionary and use it for Liechtenstein, too
+	if test -d $(INSTDIR)/share/extensions/dict-de; then \
+		cp $(INSTDIR)/share/extensions/dict-de/de_CH_frami.aff $(IOSRES)/share/spell/de_CH.aff; \
+		cp $(INSTDIR)/share/extensions/dict-de/de_CH_frami.dic $(IOSRES)/share/spell/de_CH.dic; \
+		cp $(INSTDIR)/share/extensions/dict-de/de_CH_frami.aff $(IOSRES)/share/spell/de_LI.aff; \
+		cp $(INSTDIR)/share/extensions/dict-de/de_CH_frami.dic $(IOSRES)/share/spell/de_LI.dic; \
+	fi
 	cp -R $(INSTDIR)/share/palette $(IOSRES)/share
 	cp -R $(INSTDIR)/share/fingerprint $(IOSRES)/share
 	cp $(SRCDIR)/ios/welcome.odt $(IOSRES)
diff --git a/lingucomponent/Module_lingucomponent.mk b/lingucomponent/Module_lingucomponent.mk
index 9dabeb155673..3f8bcb026fa2 100644
--- a/lingucomponent/Module_lingucomponent.mk
+++ b/lingucomponent/Module_lingucomponent.mk
@@ -15,7 +15,7 @@ $(eval $(call gb_Module_add_targets,lingucomponent,\
 	Library_hyphen \
 	$(if $(filter-out iOS,$(OS)),Library_lnth) \
 	$(if $(filter iOS MACOSX,$(OS)),Library_MacOSXSpell) \
-	$(if $(filter-out iOS,$(OS)),Library_spell) \
+	Library_spell \
 	StaticLibrary_ulingu \
 	Library_numbertext \
 ))
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index 1c9f449ce499..a3642c99c06c 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -34,6 +34,7 @@
 #include <unotools/bootstrap.hxx>
 #include <unotools/lingucfg.hxx>
 #include <unotools/pathoptions.hxx>
+#include <rtl/bootstrap.hxx>
 #include <rtl/ustring.hxx>
 #include <rtl/string.hxx>
 #include <rtl/tencinfo.h>
@@ -58,7 +59,7 @@ OString Win_AddLongPathPrefix( const OString &rPathName )
 }
 #endif //defined(_WIN32)
 
-#ifdef SYSTEM_DICTS
+#if defined SYSTEM_DICTS || defined IOS
 // find old style dictionaries in system directories
 static void GetOldStyleDicsInDir(
     OUString const & aSystemDir, OUString const & aFormatName,
@@ -143,7 +144,7 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
 
     OUString aFormatName;
     OUString aDicExtension;
-#ifdef SYSTEM_DICTS
+#if defined SYSTEM_DICTS || defined IOS
     OUString aSystemDir;
     OUString aSystemPrefix;
     OUString aSystemSuffix;
@@ -155,6 +156,10 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
 #ifdef SYSTEM_DICTS
         aSystemDir      = DICT_SYSTEM_DIR;
         aSystemSuffix   = aDicExtension;
+#elif defined IOS
+        aSystemDir      = "$BRAND_BASE_DIR/share/spell";
+        rtl::Bootstrap::expandMacros(aSystemDir);
+        aSystemSuffix   = ".dic";
 #endif
     }
     else if (strcmp( pDicType, "HYPH" ) == 0)
@@ -181,11 +186,12 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
     if (aFormatName.isEmpty() || aDicExtension.isEmpty())
         return aRes;
 
-#ifdef SYSTEM_DICTS
+#if defined SYSTEM_DICTS || defined IOS
     // set of languages to remember the language where it is already
     // decided to make use of the dictionary.
     std::set< OUString > aDicLangInUse;
 
+#ifndef IOS
     // follow the hunspell tool's example and check DICPATH for preferred dictionaries
     rtl_uString * pSearchPath = nullptr;
     osl_getEnvironment(OUString("DICPATH").pData, &pSearchPath);
@@ -220,6 +226,7 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
         }
         while (nIndex != -1);
     }
+#endif
 
     // load system directories last so that DICPATH prevails
     GetOldStyleDicsInDir(aSystemDir, aFormatName, aSystemSuffix, aSystemPrefix,
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 74b365c71746..75a1b04183a5 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -139,12 +139,13 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
                 }
             }
 #ifdef IOS
-            // iOS says it has specifically de_DE, but let's assume it is good enough for the other
-            // variants, too, for now.
+            // iOS says it has specifically de_DE. Let's assume it is good enough for German as
+            // written in Austria, Belgium, and Luxembourg, too. (Not for German in Switzerland and
+            // Liechtenstein. For those you need to bundle the myspell dictionary.)
             else if ([pLangStr isEqualToString:@"de_DE"])
             {
                 const std::vector<NSString*> aDE
-                    { @"AT", @"BE", @"CH", @"DE", @"LI", @"LU" };
+                    { @"AT", @"BE", @"DE", @"LU" };
                 for (auto c: aDE)
                 {
                     pLangStr = [@"de_" stringByAppendingString: c];
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index d4d295ad2c2f..241ec33b4541 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -93,8 +93,8 @@ $(eval $(call gb_Rdb_add_components,services,\
 	hwpfilter/source/hwp \
 	lingucomponent/source/hyphenator/hyphen/hyphen \
 	lingucomponent/source/languageguessing/guesslang \
+	lingucomponent/source/spellcheck/spell/spell \
 	$(if $(filter-out iOS,$(OS)), \
-		lingucomponent/source/spellcheck/spell/spell \
 		lingucomponent/source/thesaurus/libnth/lnth \
 	) \
 	lingucomponent/source/numbertext/numbertext \
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 207a0d4b66a0..54b9106a9c4b 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -281,7 +281,7 @@ core_constructor_list = [
     ("lingucomponent_MacSpellChecker_get_implementation", "#ifdef IOS"),
 # lingucomponent/source/thesaurus/libnth/lnth.component
     ("lingucomponent_Thesaurus_get_implementation", "#ifndef IOS"),
-    ("lingucomponent_SpellChecker_get_implementation", "#ifndef IOS"),
+    "lingucomponent_SpellChecker_get_implementation",
     "lingucomponent_LangGuess_get_implementation",
     "lingucomponent_Hyphenator_get_implementation",
 # package/source/xstor/xstor.component


More information about the Libreoffice-commits mailing list