summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx7
-rw-r--r--include/i18nlangtag/languagetag.hxx13
2 files changed, 20 insertions, 0 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index de48d068ca88..acda42e8a7a0 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1633,4 +1633,11 @@ LanguageType LanguageTag::convertToLanguageType( const OUString& rBcp47, bool bR
return LanguageTag( rBcp47).getLanguageType( bResolveSystem);
}
+
+// static
+LanguageType LanguageTag::convertToLanguageTypeWithFallback( const OUString& rBcp47 )
+{
+ return LanguageTag( rBcp47).makeFallback().getLanguageType( true);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
index d87c5e3f7821..946b459ffd44 100644
--- a/include/i18nlangtag/languagetag.hxx
+++ b/include/i18nlangtag/languagetag.hxx
@@ -435,6 +435,19 @@ public:
*/
static LanguageType convertToLanguageType( const OUString& rBcp47, bool bResolveSystem = true );
+ /** Convert BCP 47 string to MS-LangID with fallback, convenience method.
+
+ NOTE: exists only for consistency with the other convertTo...()
+ methods, internally uses a temporary LanguageTag instance for
+ conversion so does not save anything compared to
+ LanguageTag(rBcp47).makeFallback().getLanguageType(bResolveSystem).
+
+ @see makeFallback()
+
+ Always resolves an empty tag to the system locale.
+ */
+ static LanguageType convertToLanguageTypeWithFallback( const OUString& rBcp47 );
+
private:
enum Decision