diff options
Diffstat (limited to 'desktop/source/app/langselect.cxx')
-rw-r--r-- | desktop/source/app/langselect.cxx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 2ad0b382e4..e8b50cdd29 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ #include <rtl/string.hxx> #endif #ifndef _SVTOOLS_PATHOPTIONS_HXX -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #endif #include <tools/resid.hxx> #include <i18npool/mslangid.hxx> @@ -84,7 +84,7 @@ bool LanguageSelection::prepareLanguage() OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"); Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory(); Reference< XLocalizable > theConfigProvider; - try + try { theConfigProvider = Reference< XLocalizable >(theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW ); } @@ -95,7 +95,7 @@ bool LanguageSelection::prepareLanguage() return false; sal_Bool bSuccess = sal_False; - + // #i42730#get the windows 16Bit locale - it should be preferred over the UI language try { @@ -109,17 +109,17 @@ bool LanguageSelection::prepareLanguage() catch(const Exception&) { } - + // #i32939# use system locale to set document default locale - try + try { OUString usLocale; Reference< XPropertySet > xLocaleProp(getConfigAccess( "org.openoffice.System/L10N", sal_True), UNO_QUERY_THROW); - xLocaleProp->getPropertyValue(OUString::createFromAscii("Locale")) >>= usLocale; + xLocaleProp->getPropertyValue(OUString::createFromAscii("Locale")) >>= usLocale; setDefaultLanguage(usLocale); - } - catch (Exception&) + } + catch (Exception&) { } // get the selected UI language as string @@ -138,11 +138,23 @@ bool LanguageSelection::prepareLanguage() Reference< XFlushable >(theConfigProvider, UNO_QUERY_THROW)-> flush(); theConfigProvider->setLocale(loc); - + Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Setup/L10N/", sal_True), UNO_QUERY_THROW); xProp->setPropertyValue(OUString::createFromAscii("ooLocale"), makeAny(aLocaleString)); Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); + MsLangId::setConfiguredSystemUILanguage( MsLangId::convertLocaleToLanguage(loc) ); + + OUString sLocale; + xProp->getPropertyValue(OUString::createFromAscii("ooSetupSystemLocale")) >>= sLocale; + if ( sLocale.getLength() ) + { + loc = LanguageSelection::IsoStringToLocale(aLocaleString); + MsLangId::setConfiguredSystemLanguage( MsLangId::convertLocaleToLanguage(loc) ); + } + else + MsLangId::setConfiguredSystemLanguage( MsLangId::getSystemLanguage() ); + bSuccess = sal_True; } catch ( PropertyVetoException& ) @@ -289,7 +301,7 @@ static Sequence< OUString > _getFallbackLocales(const OUString& aIsoLang) if (aIsoLang.equalsAscii("zh-HK")) { seqFallbacks = Sequence< OUString >(1); seqFallbacks[0] = OUString::createFromAscii("zh-TW"); - } + } return seqFallbacks; } @@ -305,8 +317,8 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx break; } } - - if (!bInstalled && !bExact) + + if (!bInstalled && !bExact) { // try fallback locales Sequence< OUString > seqFallbacks = _getFallbackLocales(usLocale); @@ -330,7 +342,7 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx OUString aInstalledLocale; for (sal_Int32 i=0; i<seqLanguages.getLength(); i++) { - if (usLocale.indexOf(seqLanguages[i]) == 0) + if (usLocale.indexOf(seqLanguages[i]) == 0) { // requested locale starts with the installed locale // (i.e. installed locale has index 0 in requested locale) |