added LanguageTag::getGlibcLocaleString()
Change-Id: I5e77026f5c016d912fa342a5e1bca08eb445b15c
This commit is contained in:
@@ -158,6 +158,19 @@ public:
|
|||||||
*/
|
*/
|
||||||
OUString getRegion() const;
|
OUString getRegion() const;
|
||||||
|
|
||||||
|
/** Get a GLIBC locale string.
|
||||||
|
|
||||||
|
Always resolves an empty tag to the system locale.
|
||||||
|
|
||||||
|
@param rEncoding
|
||||||
|
An encoding to be appended to language_country, for example
|
||||||
|
".UTF-8" including the dot.
|
||||||
|
|
||||||
|
@return The resulting GLIBC locale string if it could be constructed,
|
||||||
|
if not an empty string is returned.
|
||||||
|
*/
|
||||||
|
OUString getGlibcLocaleString( const OUString & rEncoding ) const;
|
||||||
|
|
||||||
/** If language tag has a non-default script specified.
|
/** If language tag has a non-default script specified.
|
||||||
*/
|
*/
|
||||||
bool hasScript() const;
|
bool hasScript() const;
|
||||||
|
@@ -950,6 +950,29 @@ OUString LanguageTag::getRegion() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OUString LanguageTag::getGlibcLocaleString( const OUString & rEncoding ) const
|
||||||
|
{
|
||||||
|
OUString aRet;
|
||||||
|
if (isIsoLocale())
|
||||||
|
{
|
||||||
|
OUString aCountry( getCountry());
|
||||||
|
if (aCountry.isEmpty())
|
||||||
|
aRet = getLanguage() + rEncoding;
|
||||||
|
else
|
||||||
|
aRet = getLanguage() + "_" + aCountry + rEncoding;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME: use the aImplIsoLangGLIBCModifiersEntries table from
|
||||||
|
* i18npool/source/isolang/isolang.cxx or let liblangtag handle it. So
|
||||||
|
* far no code was prepared for anything else than a simple
|
||||||
|
* language_country locale so we don't loose anything here right now.
|
||||||
|
* */
|
||||||
|
}
|
||||||
|
return aRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LanguageTag::hasScript() const
|
bool LanguageTag::hasScript() const
|
||||||
{
|
{
|
||||||
if (!mbCachedScript)
|
if (!mbCachedScript)
|
||||||
|
Reference in New Issue
Block a user