summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-03-17 11:50:23 +0200
committerTor Lillqvist <tml@collabora.com>2021-03-17 12:03:00 +0100
commite693b5b6f5d61f8f4108cc70669ce3e5e87910a6 (patch)
treec4f5dd20a124f51ab3958399a94bb035424c5502 /lingucomponent
parent719184cfc844562b498d76d606163dd51b8738b4 (diff)
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@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112603
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/Module_lingucomponent.mk2
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx13
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.mm7
3 files changed, 15 insertions, 7 deletions
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 76c79aba698a..5ef22bbeff34 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(WNT)
-#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 ef3d5decb013..ab463e7d43aa 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -138,12 +138,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];