diff options
author | Eike Rathke <erack@redhat.com> | 2013-09-03 18:50:40 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-09-03 20:35:39 +0200 |
commit | b641e39d0aa9356717018e94925485d4755f8bbb (patch) | |
tree | d0479c4ce59727a47709a088aa92cb88706ef4b9 | |
parent | d695e8d0ea9e144e24928c45d56f59a2b59867b1 (diff) |
added convertToLanguageTypeWithFallback()
Change-Id: Ib57a7c6fc57192b4a615f5ad0e43c580769513e9
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 7 | ||||
-rw-r--r-- | include/i18nlangtag/languagetag.hxx | 13 |
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 |