configmgr/source/access.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
New commits: commit b52117c0be97c45824d2897657084f8ac7e9bf42 Author: Eike Rathke <er...@redhat.com> AuthorDate: Fri Feb 17 02:12:23 2023 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Fri Feb 17 02:39:58 2023 +0000 Try an override locale as first fallback Change-Id: I4ca6db43fef2706c4c1bab020e2170f6cf45a441 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147184 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins 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));