diff options
author | Eike Rathke <erack@redhat.com> | 2013-02-16 00:49:29 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-02-18 17:51:20 +0100 |
commit | ca04dec8b9670d936395771da43818f00e670482 (patch) | |
tree | 405bf1c9bfb51b390164012b559691d5ca03963f | |
parent | ad8f56fd333dfaf0eb97d6a3c314899a8085782c (diff) |
added LanguageTag::hasScript()
Change-Id: If9eaca46ef8daa544ee208444f79423122b10739
-rw-r--r-- | i18npool/inc/i18npool/languagetag.hxx | 8 | ||||
-rw-r--r-- | i18npool/source/languagetag/languagetag.cxx | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx index bb86b72262f0..3394c1b99fa8 100644 --- a/i18npool/inc/i18npool/languagetag.hxx +++ b/i18npool/inc/i18npool/languagetag.hxx @@ -127,6 +127,8 @@ public: /** Get ISO 15924 script code, if not the default script according to BCP 47. For default script an empty string is returned. + @see hasScript() + Always resolves an empty tag to the system locale. */ rtl::OUString getScript() const; @@ -134,6 +136,8 @@ public: /** Get combined language and script code, separated by '-' if non-default script, if default script only language. + @see hasScript() + Always resolves an empty tag to the system locale. */ rtl::OUString getLanguageAndScript() const; @@ -152,6 +156,10 @@ public: */ rtl::OUString getRegion() const; + /** If language tag has a non-default script specified. + */ + bool hasScript() const; + /** If language tag is a locale that can be expressed using only ISO 639 language codes and ISO 3166 country codes, thus is convertible to a conforming Locale struct without using extension mechanisms. diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index bab244371063..31b1ae0875e3 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -898,6 +898,14 @@ rtl::OUString LanguageTag::getRegion() const } +bool LanguageTag::hasScript() const +{ + if (!mbCachedScript) + getScript(); + return !maCachedScript.isEmpty(); +} + + bool LanguageTag::cacheSimpleLSC() { OUString aLanguage, aScript, aCountry; |