Kaydet (Commit) a72ca75e authored tarafından Eike Rathke's avatar Eike Rathke

publish the "qlt" reserved code in header file

Change-Id: Idb0bfa61655aa2f2d4b73661bce8166121727922
üst 4cf80bd8
...@@ -35,11 +35,6 @@ using namespace com::sun::star; ...@@ -35,11 +35,6 @@ using namespace com::sun::star;
#define LANGTAGCAST(p) (reinterpret_cast<lt_tag_t*>(p)) #define LANGTAGCAST(p) (reinterpret_cast<lt_tag_t*>(p))
#define MPLANGTAG LANGTAGCAST(mpImplLangtag) #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 // Helper to ensure lt_error_t is free'd
struct myLtError struct myLtError
...@@ -474,7 +469,7 @@ bool LanguageTag::canonicalize() ...@@ -474,7 +469,7 @@ bool LanguageTag::canonicalize()
} }
else else
{ {
maLocale.Language = ISO639_LANGUAGE_TAG; maLocale.Language = I18NLANGTAG_QLT;
maLocale.Country = aCountry; maLocale.Country = aCountry;
maLocale.Variant = maBcp47; maLocale.Variant = maBcp47;
} }
...@@ -574,7 +569,7 @@ void LanguageTag::convertLocaleToBcp47() ...@@ -574,7 +569,7 @@ void LanguageTag::convertLocaleToBcp47()
if (mbSystemLocale && !mbInitializedLocale) if (mbSystemLocale && !mbInitializedLocale)
convertLangToLocale(); convertLangToLocale();
if (maLocale.Language == ISO639_LANGUAGE_TAG) if (maLocale.Language == I18NLANGTAG_QLT)
{ {
maBcp47 = maLocale.Variant; maBcp47 = maLocale.Variant;
meIsIsoLocale = DECISION_NO; meIsIsoLocale = DECISION_NO;
...@@ -607,7 +602,7 @@ void LanguageTag::convertLocaleToLang() ...@@ -607,7 +602,7 @@ void LanguageTag::convertLocaleToLang()
{ {
/* FIXME: this is temporary until code base is converted to not use /* FIXME: this is temporary until code base is converted to not use
* MsLangId::convert...() anymore. After that, proper new method has to * 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); mnLangID = MsLangId::Conversion::convertLocaleToLanguage( maLocale);
} }
mbInitializedLangID = true; mbInitializedLangID = true;
...@@ -625,7 +620,7 @@ void LanguageTag::convertBcp47ToLocale() ...@@ -625,7 +620,7 @@ void LanguageTag::convertBcp47ToLocale()
} }
else else
{ {
maLocale.Language = ISO639_LANGUAGE_TAG; maLocale.Language = I18NLANGTAG_QLT;
maLocale.Country = getCountry(); maLocale.Country = getCountry();
maLocale.Variant = maBcp47; maLocale.Variant = maBcp47;
} }
...@@ -661,7 +656,7 @@ void LanguageTag::convertLangToLocale() ...@@ -661,7 +656,7 @@ void LanguageTag::convertLangToLocale()
} }
/* FIXME: this is temporary until code base is converted to not use /* FIXME: this is temporary until code base is converted to not use
* MsLangId::convert...() anymore. After that, proper new method has to be * 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! // Resolve system here!
maLocale = MsLangId::Conversion::convertLanguageToLocale( mnLangID, true); maLocale = MsLangId::Conversion::convertLanguageToLocale( mnLangID, true);
mbInitializedLocale = true; mbInitializedLocale = true;
......
...@@ -21,6 +21,20 @@ ...@@ -21,6 +21,20 @@
typedef struct _rtl_Locale rtl_Locale; // as in rtl/locale.h 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 /** Wrapper for liblangtag BCP 47 language tags, MS-LangIDs, locales and
conversions in between. conversions in between.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment