diff options
author | Eike Rathke <erack@redhat.com> | 2013-07-05 21:01:35 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-05 21:02:49 +0200 |
commit | 4467a4a6280306770107488b4a97c4d496c95a43 (patch) | |
tree | b57ee2e85843a94645c50681a4128e47d7c7ade2 /i18nlangtag | |
parent | 6a17dc24a40824aef91ae640ab712e4db8d8eb77 (diff) |
added convenience ctor for ODF import
Change-Id: I80fc2d531b612d9e2e94fc4f5efcca594e35a561
Diffstat (limited to 'i18nlangtag')
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 68c3aebe9768..f0333b8103a3 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -206,6 +206,44 @@ LanguageTag::LanguageTag( LanguageType nLanguage ) } +LanguageTag::LanguageTag( const OUString& rBcp47, const OUString& rLanguage, + const OUString& rScript, const OUString& rCountry ) + : + maBcp47( rBcp47), + mpImplLangtag( NULL), + mnLangID( LANGUAGE_DONTKNOW), + meIsValid( DECISION_DONTKNOW), + meIsIsoLocale( DECISION_DONTKNOW), + meIsIsoODF( DECISION_DONTKNOW), + meIsLiblangtagNeeded( DECISION_DONTKNOW), + mbSystemLocale( rBcp47.isEmpty() && rLanguage.isEmpty()), + mbInitializedBcp47( !rBcp47.isEmpty()), + mbInitializedLocale( false), + mbInitializedLangID( false), + mbCachedLanguage( false), + mbCachedScript( false), + mbCachedCountry( false), + mbIsFallback( false) +{ + if (!mbSystemLocale && !mbInitializedBcp47) + { + if (rScript.isEmpty()) + { + maLocale = lang::Locale( rLanguage, rCountry, ""); + mbInitializedLocale = true; + } + else + { + if (rCountry.isEmpty()) + maBcp47 = rLanguage + "-" + rScript; + else + maBcp47 = rLanguage + "-" + rScript + "-" + rCountry; + mbInitializedBcp47 = true; + } + } +} + + LanguageTag::LanguageTag( const OUString& rLanguage, const OUString& rCountry ) : maLocale( rLanguage, rCountry, ""), |