diff options
author | Eike Rathke <erack@redhat.com> | 2013-09-02 18:01:13 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-09-02 18:20:51 +0200 |
commit | 49656398d43fa03f8adb70b9be417f2fd65dd9ea (patch) | |
tree | ab6f355984b0cf8d81ec566debdc76fd6e73d877 /include/i18nlangtag | |
parent | 8614ff2993b2fe49b27311546290d957f036487c (diff) |
simpleExtract() with variants
rsc needs to resolve all known defined languages without access to
liblangtag because that would need
/usr/local/share/liblangtag/language-subtag-registry.xml so we'd end up
with a bootstrap problem (or would have to pass the database path).
Change-Id: I6b966d45080da26cb89169cdb40cd8a58c04a276
Diffstat (limited to 'include/i18nlangtag')
-rw-r--r-- | include/i18nlangtag/languagetag.hxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx index 403221fe754f..d87c5e3f7821 100644 --- a/include/i18nlangtag/languagetag.hxx +++ b/include/i18nlangtag/languagetag.hxx @@ -449,6 +449,7 @@ private: mutable OUString maCachedLanguage; ///< cache getLanguage() mutable OUString maCachedScript; ///< cache getScript() mutable OUString maCachedCountry; ///< cache getCountry() + mutable OUString maCachedVariants; ///< cache getVariants() mutable void* mpImplLangtag; ///< actually lt_tag_t pointer, encapsulated mutable LanguageType mnLangID; mutable Decision meIsValid; @@ -462,6 +463,7 @@ private: mutable bool mbCachedLanguage : 1; mutable bool mbCachedScript : 1; mutable bool mbCachedCountry : 1; + mutable bool mbCachedVariants : 1; bool mbIsFallback : 1; void convertLocaleToBcp47(); @@ -489,12 +491,12 @@ private: void resetVars(); - /** Obtain Language, Script and Country via simpleExtract() and assign them - to the cached variables if successful. + /** Obtain Language, Script, Country and Variants via simpleExtract() and + assign them to the cached variables if successful. @return return of simpleExtract() */ - bool cacheSimpleLSC(); + bool cacheSimpleLSCV(); static bool isIsoLanguage( const OUString& rLanguage ); static bool isIsoScript( const OUString& rScript ); @@ -504,23 +506,28 @@ private: { EXTRACTED_NONE, EXTRACTED_LSC, + EXTRACTED_LV, EXTRACTED_X, EXTRACTED_X_JOKER }; - /** Of a simple language tag of the form lll[-Ssss][-CC] (i.e. one that - would fulfill the isIsoODF() condition) extract the portions. + /** Of a language tag of the form lll[-Ssss][-CC][-vvvvvvvv] extract the + portions. Does not check case or content! - @return EXTRACTED_LSC if simple tag was detected, EXTRACTED_X if x-... - privateuse tag was detected, EXTRACTED_X_JOKER if "*" joker was - detected, else EXTRACTED_NONE. + @return EXTRACTED_LSC if simple tag was detected (i.e. one that + would fulfill the isIsoODF() condition), + EXTRACTED_LV if a tag with variant was detected, + EXTRACTED_X if x-... privateuse tag was detected, + EXTRACTED_X_JOKER if "*" joker was detected, + EXTRACTED_NONE else. */ static Extraction simpleExtract( const OUString& rBcp47, OUString& rLanguage, OUString& rScript, - OUString& rCountry ); + OUString& rCountry, + OUString& rVariants ); }; |