diff options
author | Eike Rathke <erack@redhat.com> | 2012-12-11 11:46:19 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-12-11 13:00:31 +0100 |
commit | 4d24507451fbc2b7d72cf5f7048a424d52b63850 (patch) | |
tree | dccb6fce627a9890d65aed2787612cc5024cc15b /i18npool/inc | |
parent | 055fca04a4e00b14e68fa5860b417cb25e471299 (diff) |
avoid liblangtag processing for known locales, and know 'qtz'
For "simple" known (to us) locales avoid the overhead of liblangtag,
also in preparation of not having to initialize its database during
startup.
This also enables recognition of the 'qtz' pseudolocale for key ID
resources again, see fdo#57413
Change-Id: Id52a1ddc37b42063e3bf68a6dbeaeacfbfa704ef
Diffstat (limited to 'i18npool/inc')
-rw-r--r-- | i18npool/inc/i18npool/languagetag.hxx | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx index 0b3eeddd150f..bb86b72262f0 100644 --- a/i18npool/inc/i18npool/languagetag.hxx +++ b/i18npool/inc/i18npool/languagetag.hxx @@ -229,6 +229,7 @@ private: mutable Decision meIsValid; mutable Decision meIsIsoLocale; mutable Decision meIsIsoODF; + mutable Decision meIsLiblangtagNeeded; ///< whether processing with liblangtag needed bool mbSystemLocale : 1; mutable bool mbInitializedBcp47 : 1; mutable bool mbInitializedLocale : 1; @@ -245,17 +246,36 @@ private: void convertLangToLocale(); void convertLangToBcp47(); - bool canonicalize() const; + bool canonicalize(); - rtl::OUString getLanguageFromLangtag() const; - rtl::OUString getScriptFromLangtag() const; - rtl::OUString getRegionFromLangtag() const; + rtl::OUString getLanguageFromLangtag(); + rtl::OUString getScriptFromLangtag(); + rtl::OUString getRegionFromLangtag(); void resetVars(); + /** Obtain Language, Script and Country via simpleExtract() and assign them + to the cached variables if successful. + + @return return of simpleExtract() + */ + bool cacheSimpleLSC(); + static bool isIsoLanguage( const rtl::OUString& rLanguage ); static bool isIsoScript( const rtl::OUString& rScript ); static bool isIsoCountry( const rtl::OUString& rRegion ); + + /** Of a simple language tag of the form lll[-Ssss][-CC] (i.e. one that + would fulfill the isIsoODF() condition) extract the portions. + + Does not check case or content! + + @return TRUE if it detected a simple tag, else FALSE. + */ + static bool simpleExtract( const rtl::OUString& rBcp47, + rtl::OUString& rLanguage, + rtl::OUString& rScript, + rtl::OUString& rCountry ); }; #endif // INCLUDED_I18NPOOL_LANGUAGETAG_HXX |