summaryrefslogtreecommitdiff
path: root/unotools/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-04-10 18:45:03 +0200
committerEike Rathke <erack@redhat.com>2013-04-10 21:10:23 +0200
commita6f169433ada74a81b2e3421ea9c68a36c821fbb (patch)
treeebe596de8c3673b7eb2c1749afa080f030d64570 /unotools/source
parentd91b76bcc47a28825ae7e8fc3c1c5a93af20782b (diff)
use language tags
Change-Id: I0e0e6f05f69a173d230a32bc1c39a1bf18fc052f
Diffstat (limited to 'unotools/source')
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx43
1 files changed, 11 insertions, 32 deletions
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 8f849d3e2892..45f24499c70e 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -146,6 +146,8 @@ void LocaleDataWrapper::invalidateData()
}
+/* FIXME-BCP47: locale data should provide a language tag instead that could be
+ * passed on. */
::com::sun::star::i18n::LanguageCountryInfo LocaleDataWrapper::getLanguageCountryInfo() const
{
try
@@ -259,7 +261,7 @@ void LocaleDataWrapper::invalidateData()
if ( !rInstalledLocales.getLength() )
{
- LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), LanguageTag( lang::Locale()) );
+ LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), LanguageTag( LANGUAGE_SYSTEM) );
aLDW.getAllInstalledLocaleNames();
}
return rInstalledLocales;
@@ -281,37 +283,14 @@ void LocaleDataWrapper::invalidateData()
sal_Int32 nLanguages = 0;
for ( sal_Int32 i=0; i<nCount; i++ )
{
- String aDebugLocale;
+ LanguageTag aLanguageTag( xLoc[i] );
+ OUString aDebugLocale;
if (areChecksEnabled())
{
- /* FIXME-BCP47: handle language tags! */
- aDebugLocale = xLoc[i].Language;
- if ( !xLoc[i].Country.isEmpty() )
- {
- aDebugLocale += '-';
- aDebugLocale += String( xLoc[i].Country);
- if ( !xLoc[i].Variant.isEmpty() )
- {
- aDebugLocale += '-';
- aDebugLocale += String( xLoc[i].Variant);
- }
- }
- }
-
- if ( !xLoc[i].Variant.isEmpty() )
- {
- if (areChecksEnabled())
- {
- OUStringBuffer aMsg("LocaleDataWrapper::getInstalledLanguageTypes: Variants not supported, locale\n");
- aMsg.append(aDebugLocale);
- outputCheckMessage(aMsg.makeStringAndClear());
- }
- continue;
+ aDebugLocale = aLanguageTag.getBcp47( false);
}
- LanguageTag aLanguageTag( xLoc[i] );
- LanguageType eLang = aLanguageTag.getLanguageType();
- // In checks, exclude known problems because no MS-LCID defined.
+ LanguageType eLang = aLanguageTag.getLanguageType( false);
if (areChecksEnabled() && eLang == LANGUAGE_DONTKNOW)
{
OUStringBuffer aMsg("ConvertIsoNamesToLanguage: unknown MS-LCID for locale\n");
@@ -333,10 +312,10 @@ void LocaleDataWrapper::invalidateData()
// In checks, exclude known problems because no MS-LCID defined
// and default for Language found.
if ( areChecksEnabled()
- && !aDebugLocale.EqualsAscii( "ar-SD" ) // Sudan/ar
- && !aDebugLocale.EqualsAscii( "en-CB" ) // Carribean is not a country
-// && !aDebugLocale.EqualsAscii( "en-BG" ) // ?!? Bulgaria/en
-// && !aDebugLocale.EqualsAscii( "es-BR" ) // ?!? Brazil/es
+ && aDebugLocale != "ar-SD" // Sudan/ar
+ && aDebugLocale != "en-CB" // Carribean is not a country
+// && aDebugLocale != "en-BG" // ?!? Bulgaria/en
+// && aDebugLocale != "es-BR" // ?!? Brazil/es
)
{
OUStringBuffer aMsg("ConvertIsoNamesToLanguage/ConvertLanguageToIsoNames: ambiguous locale (MS-LCID?)\n");