summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-10-04 11:14:38 +0200
committerEike Rathke <erack@redhat.com>2022-10-04 19:15:45 +0200
commit437abb3abbc506c1e20c6fec8e574abfe3487842 (patch)
treea107154f0737c2c74bb70aecd752b8b648a410f1 /editeng
parent71e11268569201f5dcd4dbc1e7560c4530b077fb (diff)
Check acor_langtag for language-script fallback instead of only language
A tag with script could be added for which we don't have locale data but for the same language in another script. Do not fall back to that. With that the share/autocorr/acor_zh-{CN,TW}.dat files created additional Asian language listbox entries "Chinese (Simplified, China) {zh-Hans-CN}" "Chinese (Traditional, Taiwan) {zh-Hant-TW}" because those are the canonicalized language tags. Prefer the known legacy zh-CN and zh-TW tags instead. Could also had happened with any document import. Which again revealed a flaw in the handling of mapping overrides where converting from a LanguageType LCID to Locale could yield a different mapping than from BCP47 to LCID, which in the case of a fallback for locale data lead to odd side effects. Change-Id: I1e2aaa8e9f99b6b3bc2c9a661215cb00bddd33d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140939 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/acorrcfg.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 5806179bc5f0..53a43cff3f22 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -75,20 +75,20 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL )
if (SvtLanguageTable::HasLanguageType( aLanguageTag.getLanguageType()))
continue;
- // Insert language-only tags only if there is no known
- // matching fallback locale, otherwise we'd end up with
- // unwanted entries where a language autocorrection
- // file covers several locales. We do know a few
- // art-x-... though so exclude those and any other
- // private-use tag (which should not fallback, but
- // avoid).
+ // Insert language(-script)-only tags only if there is
+ // no known matching fallback locale, otherwise we'd
+ // end up with unwanted entries where a language
+ // autocorrection file covers several locales. We do
+ // know a few art-x-... though so exclude those and any
+ // other private-use tag (which should not fallback,
+ // but avoid).
if (aLanguageTag.getCountry().isEmpty()
&& LanguageTag::isValidBcp47( aCanonicalized, nullptr,
LanguageTag::PrivateUse::DISALLOW))
{
LanguageTag aFallback( aLanguageTag);
aFallback.makeFallback();
- if (aFallback.getLanguage() == aLanguageTag.getLanguage())
+ if (aFallback.getLanguageAndScript() == aLanguageTag.getLanguageAndScript())
continue;
}