summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-11-27 18:41:58 +0100
committerEike Rathke <erack@redhat.com>2012-11-27 18:43:19 +0100
commit52b10fdedb9a056cd8f4ef5f01863a3bb1e249c1 (patch)
tree4a1226fd2e0f90d3204b0073a1da3a09a5785f8f /desktop
parent6215da2dfb96ed6b36ef42bc1afa1ab43c803f3d (diff)
get rid of LanguageSelection::IsoStringToLocale() and use LanguageTag
Change-Id: Id327a4164435ee2e22980827ab21a5affdb8de9d
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/langselect.cxx26
-rw-r--r--desktop/source/app/langselect.hxx1
-rw-r--r--desktop/source/app/userinstall.cxx4
3 files changed, 10 insertions, 21 deletions
diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx
index db8d0df754c8..085e0a74a1d0 100644
--- a/desktop/source/app/langselect.cxx
+++ b/desktop/source/app/langselect.cxx
@@ -105,16 +105,6 @@ static OUString locateSofficeIniFile()
return aSofficeIniFileURL;
}
-Locale LanguageSelection::IsoStringToLocale(const OUString& str)
-{
- Locale l;
- sal_Int32 index=0;
- l.Language = str.getToken(0, '-', index);
- if (index >= 0) l.Country = str.getToken(0, '-', index);
- if (index >= 0) l.Variant = str.getToken(0, '-', index);
- return l;
-}
-
bool LanguageSelection::prepareLanguage()
{
m_eStatus = LS_STATUS_OK;
@@ -200,11 +190,11 @@ bool LanguageSelection::prepareLanguage()
{
try
{
- // prepare default config provider by localizing it to the selected locale
- // this will ensure localized configuration settings to be selected accoring to the
- // UI language.
- Locale loc = LanguageSelection::IsoStringToLocale(aLocaleString);
- theConfigProvider->setLocale(loc);
+ // prepare default config provider by localizing it to the selected
+ // locale this will ensure localized configuration settings to be
+ // selected according to the UI language.
+ LanguageTag aUILanguageTag(aLocaleString);
+ theConfigProvider->setLocale(aUILanguageTag.getLocale( false));
Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Setup/L10N/", sal_True), UNO_QUERY_THROW);
if ( !bCmdLanguage )
@@ -222,14 +212,14 @@ bool LanguageSelection::prepareLanguage()
Reference< XChangesBatch >(xProp2, UNO_QUERY_THROW)->commitChanges();
}
- MsLangId::setConfiguredSystemUILanguage( LanguageTag(loc).getLanguageType( false) );
+ MsLangId::setConfiguredSystemUILanguage( aUILanguageTag.getLanguageType( false) );
OUString sLocale;
xProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale"))) >>= sLocale;
if ( !sLocale.isEmpty() )
{
- loc = LanguageSelection::IsoStringToLocale(sLocale);
- MsLangId::setConfiguredSystemLanguage( LanguageTag(loc).getLanguageType( false) );
+ LanguageTag aLocaleLanguageTag(sLocale);
+ MsLangId::setConfiguredSystemLanguage( aLocaleLanguageTag.getLanguageType( false) );
}
else
MsLangId::setConfiguredSystemLanguage( MsLangId::getSystemLanguage() );
diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx
index 7fc0827b9d36..b6ded29741ac 100644
--- a/desktop/source/app/langselect.hxx
+++ b/desktop/source/app/langselect.hxx
@@ -39,7 +39,6 @@ public:
LS_STATUS_CONFIGURATIONACCESS_BROKEN
};
- static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str);
static rtl::OUString getLanguageString();
static bool prepareLanguage();
static LanguageSelectionStatus getStatus();
diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx
index 115be47b7d23..612a804945d6 100644
--- a/desktop/source/app/userinstall.cxx
+++ b/desktop/source/app/userinstall.cxx
@@ -71,8 +71,8 @@ namespace desktop {
// localize the provider to user selection
Reference< XLocalizable > localizable(theConfigProvider, UNO_QUERY_THROW);
OUString aUserLanguage = LanguageSelection::getLanguageString();
- Locale aLocale = LanguageSelection::IsoStringToLocale(aUserLanguage);
- localizable->setLocale(aLocale);
+ LanguageTag aLanguageTag(aUserLanguage);
+ localizable->setLocale(aLanguageTag.getLocale( false));
return officecfg::Setup::Office::ooSetupInstCompleted::get();
}