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

use language tags

Change-Id: I0e0e6f05f69a173d230a32bc1c39a1bf18fc052f
üst d91b76bc
...@@ -146,6 +146,8 @@ void LocaleDataWrapper::invalidateData() ...@@ -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 ::com::sun::star::i18n::LanguageCountryInfo LocaleDataWrapper::getLanguageCountryInfo() const
{ {
try try
...@@ -259,7 +261,7 @@ void LocaleDataWrapper::invalidateData() ...@@ -259,7 +261,7 @@ void LocaleDataWrapper::invalidateData()
if ( !rInstalledLocales.getLength() ) if ( !rInstalledLocales.getLength() )
{ {
LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), LanguageTag( lang::Locale()) ); LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), LanguageTag( LANGUAGE_SYSTEM) );
aLDW.getAllInstalledLocaleNames(); aLDW.getAllInstalledLocaleNames();
} }
return rInstalledLocales; return rInstalledLocales;
...@@ -281,37 +283,14 @@ void LocaleDataWrapper::invalidateData() ...@@ -281,37 +283,14 @@ void LocaleDataWrapper::invalidateData()
sal_Int32 nLanguages = 0; sal_Int32 nLanguages = 0;
for ( sal_Int32 i=0; i<nCount; i++ ) for ( sal_Int32 i=0; i<nCount; i++ )
{ {
String aDebugLocale; LanguageTag aLanguageTag( xLoc[i] );
OUString aDebugLocale;
if (areChecksEnabled()) if (areChecksEnabled())
{ {
/* FIXME-BCP47: handle language tags! */ aDebugLocale = aLanguageTag.getBcp47( false);
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;
} }
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) if (areChecksEnabled() && eLang == LANGUAGE_DONTKNOW)
{ {
OUStringBuffer aMsg("ConvertIsoNamesToLanguage: unknown MS-LCID for locale\n"); OUStringBuffer aMsg("ConvertIsoNamesToLanguage: unknown MS-LCID for locale\n");
...@@ -333,10 +312,10 @@ void LocaleDataWrapper::invalidateData() ...@@ -333,10 +312,10 @@ void LocaleDataWrapper::invalidateData()
// In checks, exclude known problems because no MS-LCID defined // In checks, exclude known problems because no MS-LCID defined
// and default for Language found. // and default for Language found.
if ( areChecksEnabled() if ( areChecksEnabled()
&& !aDebugLocale.EqualsAscii( "ar-SD" ) // Sudan/ar && aDebugLocale != "ar-SD" // Sudan/ar
&& !aDebugLocale.EqualsAscii( "en-CB" ) // Carribean is not a country && aDebugLocale != "en-CB" // Carribean is not a country
// && !aDebugLocale.EqualsAscii( "en-BG" ) // ?!? Bulgaria/en // && aDebugLocale != "en-BG" // ?!? Bulgaria/en
// && !aDebugLocale.EqualsAscii( "es-BR" ) // ?!? Brazil/es // && aDebugLocale != "es-BR" // ?!? Brazil/es
) )
{ {
OUStringBuffer aMsg("ConvertIsoNamesToLanguage/ConvertLanguageToIsoNames: ambiguous locale (MS-LCID?)\n"); OUStringBuffer aMsg("ConvertIsoNamesToLanguage/ConvertLanguageToIsoNames: ambiguous locale (MS-LCID?)\n");
......
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