summaryrefslogtreecommitdiff
path: root/i18nlangtag
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-10-25 11:41:09 +0200
committerEike Rathke <erack@redhat.com>2021-10-25 13:07:50 +0200
commita6baab25b53d0a87686a5fcdabf86747e9678021 (patch)
tree35da354bc3ed797302cd13760320992218f3cb0d /i18nlangtag
parent98eb119fed253b0af7a3b5c9a28905d29118167f (diff)
Introduce LanguageTag::convertToLanguageTypeWithFallback(Locale)
... with keeping LANGUAGE_SYSTEM not resolved or falling back. Change-Id: I10211c2b2140a9822f1403dc00af3ee9ded08f69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124140 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'i18nlangtag')
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index ebad94022615..6f6a766e861f 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -2813,6 +2813,16 @@ css::lang::Locale LanguageTag::convertToLocaleWithFallback( const OUString& rBcp
// static
+LanguageType LanguageTag::convertToLanguageTypeWithFallback( const css::lang::Locale& rLocale, bool bResolveSystem )
+{
+ if (rLocale.Language.isEmpty() && !bResolveSystem)
+ return LANGUAGE_SYSTEM;
+
+ return LanguageTag( rLocale).makeFallback().getLanguageType();
+}
+
+
+// static
bool LanguageTag::isValidBcp47( const OUString& rString, OUString* o_pCanonicalized, bool bDisallowPrivate )
{
bool bValid = false;