diff options
author | Eike Rathke <erack@redhat.com> | 2023-02-17 02:12:23 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2023-02-17 02:39:58 +0000 |
commit | b52117c0be97c45824d2897657084f8ac7e9bf42 (patch) | |
tree | 6787392d506acbf77aec994bee0d95706b91378d /configmgr/source | |
parent | 66719bbdf9d433be8208fac5dbad9e1e9ecebdd5 (diff) |
Try an override locale as first fallback
Change-Id: I4ca6db43fef2706c4c1bab020e2170f6cf45a441
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147184
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'configmgr/source')
-rw-r--r-- | configmgr/source/access.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 9d71c7fa2978..047c93a5627a 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -1394,9 +1394,19 @@ rtl::Reference< ChildAccess > Access::getChild(OUString const & name) { if (directChild.is()) return directChild; + LanguageTag aLanguageTag(locale, true); + if (aLanguageTag.getBcp47() != locale) + { + // Original may be overridden by a known locale, for example + // "zh-Hant-TW" by "zh-TW". + rtl::Reference<ChildAccess> child(getChild(aLanguageTag.getBcp47())); + if (child.is()) + return child; + } + // Find the best match using the LanguageTag fallback mechanism, // excluding the original tag. - std::vector<OUString> aFallbacks = LanguageTag(locale).getFallbackStrings(false); + std::vector<OUString> aFallbacks = aLanguageTag.getFallbackStrings(false); for (const OUString& rFallback : aFallbacks) { rtl::Reference<ChildAccess> child(getChild(rFallback)); |