[Libreoffice-commits] core.git: i18nlangtag/source include/i18nlangtag

Eike Rathke erack at redhat.com
Tue Jul 9 03:27:32 PDT 2013


 i18nlangtag/source/languagetag/languagetag.cxx |   15 +++++----------
 include/i18nlangtag/languagetag.hxx            |   14 ++++++++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit a72ca75e33c351b00801869aec570a277aaa646a
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 9 12:24:45 2013 +0200

    publish the "qlt" reserved code in header file
    
    Change-Id: Idb0bfa61655aa2f2d4b73661bce8166121727922

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index f0333b8..673960f 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -35,11 +35,6 @@ using namespace com::sun::star;
 #define LANGTAGCAST(p) (reinterpret_cast<lt_tag_t*>(p))
 #define MPLANGTAG LANGTAGCAST(mpImplLangtag)
 
-/** Convention to signal presence of BCP 47 language tag in a Locale's Variant
-    field. The Locale's Language field then will contain this ISO 639-2
-    reserved for local use code. */
-#define ISO639_LANGUAGE_TAG "qlt"
-
 
 // Helper to ensure lt_error_t is free'd
 struct myLtError
@@ -474,7 +469,7 @@ bool LanguageTag::canonicalize()
                     }
                     else
                     {
-                        maLocale.Language = ISO639_LANGUAGE_TAG;
+                        maLocale.Language = I18NLANGTAG_QLT;
                         maLocale.Country  = aCountry;
                         maLocale.Variant  = maBcp47;
                     }
@@ -574,7 +569,7 @@ void LanguageTag::convertLocaleToBcp47()
     if (mbSystemLocale && !mbInitializedLocale)
         convertLangToLocale();
 
-    if (maLocale.Language == ISO639_LANGUAGE_TAG)
+    if (maLocale.Language == I18NLANGTAG_QLT)
     {
         maBcp47 = maLocale.Variant;
         meIsIsoLocale = DECISION_NO;
@@ -607,7 +602,7 @@ void LanguageTag::convertLocaleToLang()
     {
         /* FIXME: this is temporary until code base is converted to not use
          * MsLangId::convert...() anymore. After that, proper new method has to
-         * be implemented to allow ISO639_LANGUAGE_TAG and sript tag and such. */
+         * be implemented to allow I18NLANGTAG_QLT and sript tag and such. */
         mnLangID = MsLangId::Conversion::convertLocaleToLanguage( maLocale);
     }
     mbInitializedLangID = true;
@@ -625,7 +620,7 @@ void LanguageTag::convertBcp47ToLocale()
     }
     else
     {
-        maLocale.Language = ISO639_LANGUAGE_TAG;
+        maLocale.Language = I18NLANGTAG_QLT;
         maLocale.Country = getCountry();
         maLocale.Variant = maBcp47;
     }
@@ -661,7 +656,7 @@ void LanguageTag::convertLangToLocale()
     }
     /* FIXME: this is temporary until code base is converted to not use
      * MsLangId::convert...() anymore. After that, proper new method has to be
-     * implemented to allow ISO639_LANGUAGE_TAG and script tag and such. */
+     * implemented to allow I18NLANGTAG_QLT and script tag and such. */
     // Resolve system here!
     maLocale = MsLangId::Conversion::convertLanguageToLocale( mnLangID, true);
     mbInitializedLocale = true;
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
index 1a9f499..7fa9b96 100644
--- a/include/i18nlangtag/languagetag.hxx
+++ b/include/i18nlangtag/languagetag.hxx
@@ -21,6 +21,20 @@
 typedef struct _rtl_Locale rtl_Locale;  // as in rtl/locale.h
 
 
+/** The ISO 639-2 code reserved for local use used to indicate that a
+    com::sun::star::Locale contains a BCP 47 string in its Variant field. The
+    Locale's Language field then will contain this language code.
+
+    @see LanguageTag::getLocale()
+
+    Avoid use, only needed internally or if conversion from Locale to
+    LanguageTag is not wanted, i.e. during ODF import. To check whether a
+    LanguageTag contains a plain language/country combination or a more
+    detailed BCP 47 language tag use LanguageTag::isIsoLocale() instead.
+ */
+#define I18NLANGTAG_QLT "qlt"
+
+
 /** Wrapper for liblangtag BCP 47 language tags, MS-LangIDs, locales and
     conversions in between.
 


More information about the Libreoffice-commits mailing list