resolved fdo#72778 keep setting system locale and LanguageTag in sync
Change-Id: I3547786bf77b8f611bc08d0e52c66ac00e199f13
This commit is contained in:
@@ -197,7 +197,7 @@ bool prepareLocale() {
|
|||||||
}
|
}
|
||||||
MsLangId::setConfiguredSystemUILanguage(tag.getLanguageType(false));
|
MsLangId::setConfiguredSystemUILanguage(tag.getLanguageType(false));
|
||||||
OUString setupSysLoc(officecfg::Setup::L10N::ooSetupSystemLocale::get());
|
OUString setupSysLoc(officecfg::Setup::L10N::ooSetupSystemLocale::get());
|
||||||
MsLangId::setConfiguredSystemLanguage(
|
LanguageTag::setConfiguredSystemLanguage(
|
||||||
setupSysLoc.isEmpty()
|
setupSysLoc.isEmpty()
|
||||||
? MsLangId::getSystemLanguage()
|
? MsLangId::getSystemLanguage()
|
||||||
: LanguageTag(setupSysLoc).getLanguageType(false));
|
: LanguageTag(setupSysLoc).getLanguageType(false));
|
||||||
|
@@ -37,7 +37,7 @@ LanguageType MsLangId::nConfiguredAsianFallback = LANGUAGE_SYSTEM;
|
|||||||
LanguageType MsLangId::nConfiguredComplexFallback = LANGUAGE_SYSTEM;
|
LanguageType MsLangId::nConfiguredComplexFallback = LANGUAGE_SYSTEM;
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void MsLangId::setConfiguredSystemLanguage( LanguageType nLang )
|
void MsLangId::LanguageTagAccess::setConfiguredSystemLanguage( LanguageType nLang )
|
||||||
{
|
{
|
||||||
nConfiguredSystemLanguage = nLang;
|
nConfiguredSystemLanguage = nLang;
|
||||||
}
|
}
|
||||||
|
@@ -364,7 +364,6 @@ private:
|
|||||||
/** Convert Locale to BCP 47 string without resolving system and creating
|
/** Convert Locale to BCP 47 string without resolving system and creating
|
||||||
temporary LanguageTag instances. */
|
temporary LanguageTag instances. */
|
||||||
static OUString convertToBcp47( const com::sun::star::lang::Locale& rLocale );
|
static OUString convertToBcp47( const com::sun::star::lang::Locale& rLocale );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -713,6 +712,24 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
|
|||||||
return pImpl;
|
return pImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void LanguageTag::setConfiguredSystemLanguage( LanguageType nLang )
|
||||||
|
{
|
||||||
|
if (nLang == LANGUAGE_DONTKNOW || nLang == LANGUAGE_SYSTEM)
|
||||||
|
{
|
||||||
|
SAL_WARN( "i18nlangtag",
|
||||||
|
"LanguageTag::setConfiguredSystemLanguage: refusing to set unresolved system locale 0x" <<
|
||||||
|
::std::hex << nLang);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SAL_INFO( "i18nlangtag", "LanguageTag::setConfiguredSystemLanguage: setting to 0x" << ::std::hex << nLang);
|
||||||
|
MsLangId::LanguageTagAccess::setConfiguredSystemLanguage( nLang);
|
||||||
|
// Resest system locale to none and let registerImpl() do the rest to
|
||||||
|
// initialize a new one.
|
||||||
|
theSystemLocale::get().reset();
|
||||||
|
LanguageTag aLanguageTag( LANGUAGE_SYSTEM);
|
||||||
|
aLanguageTag.registerImpl();
|
||||||
|
}
|
||||||
|
|
||||||
static bool lcl_isKnownOnTheFlyID( LanguageType nLang )
|
static bool lcl_isKnownOnTheFlyID( LanguageType nLang )
|
||||||
{
|
{
|
||||||
|
@@ -498,6 +498,9 @@ public:
|
|||||||
/** If nLang is a generated on-the-fly LangID */
|
/** If nLang is a generated on-the-fly LangID */
|
||||||
static bool isOnTheFlyID( LanguageType nLang );
|
static bool isOnTheFlyID( LanguageType nLang );
|
||||||
|
|
||||||
|
/** @ATTENTION: _ONLY_ to be called by the application's configuration! */
|
||||||
|
static void setConfiguredSystemLanguage( LanguageType nLang );
|
||||||
|
|
||||||
typedef ::boost::shared_ptr< LanguageTagImpl > ImplPtr;
|
typedef ::boost::shared_ptr< LanguageTagImpl > ImplPtr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -172,12 +172,28 @@ public:
|
|||||||
|
|
||||||
/** @ATTENTION: these are _ONLY_ to be called by the application's
|
/** @ATTENTION: these are _ONLY_ to be called by the application's
|
||||||
configuration! */
|
configuration! */
|
||||||
static void setConfiguredSystemLanguage( LanguageType nLang );
|
|
||||||
static void setConfiguredSystemUILanguage( LanguageType nLang );
|
static void setConfiguredSystemUILanguage( LanguageType nLang );
|
||||||
static void setConfiguredWesternFallback( LanguageType nLang );
|
static void setConfiguredWesternFallback( LanguageType nLang );
|
||||||
static void setConfiguredComplexFallback( LanguageType nLang );
|
static void setConfiguredComplexFallback( LanguageType nLang );
|
||||||
static void setConfiguredAsianFallback( LanguageType nLang );
|
static void setConfiguredAsianFallback( LanguageType nLang );
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Encapsulated methods that shall only be accessed through
|
||||||
|
class LanguageTag.
|
||||||
|
*/
|
||||||
|
class LanguageTagAccess
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class LanguageTag;
|
||||||
|
|
||||||
|
/** Configured system locale needs always be synchronized with
|
||||||
|
LanguageTag's system locale.
|
||||||
|
*/
|
||||||
|
I18NLANGTAG_DLLPRIVATE static void setConfiguredSystemLanguage( LanguageType nLang );
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
struct LanguagetagMapping
|
struct LanguagetagMapping
|
||||||
|
@@ -401,7 +401,7 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr )
|
|||||||
{
|
{
|
||||||
m_aLocaleString = rStr;
|
m_aLocaleString = rStr;
|
||||||
MakeRealLocale();
|
MakeRealLocale();
|
||||||
MsLangId::setConfiguredSystemLanguage( m_aRealLocale.getLanguageType() );
|
LanguageTag::setConfiguredSystemLanguage( m_aRealLocale.getLanguageType() );
|
||||||
SetModified();
|
SetModified();
|
||||||
sal_uLong nHint = SYSLOCALEOPTIONS_HINT_LOCALE;
|
sal_uLong nHint = SYSLOCALEOPTIONS_HINT_LOCALE;
|
||||||
if ( m_aCurrencyString.isEmpty() )
|
if ( m_aCurrencyString.isEmpty() )
|
||||||
@@ -418,7 +418,7 @@ void SvtSysLocaleOptions_Impl::SetUILocaleString( const OUString& rStr )
|
|||||||
|
|
||||||
// as we can't switch UILocale at runtime, we only store changes in the configuration
|
// as we can't switch UILocale at runtime, we only store changes in the configuration
|
||||||
MakeRealUILocale();
|
MakeRealUILocale();
|
||||||
MsLangId::setConfiguredSystemLanguage( m_aRealUILocale.getLanguageType() );
|
LanguageTag::setConfiguredSystemLanguage( m_aRealUILocale.getLanguageType() );
|
||||||
SetModified();
|
SetModified();
|
||||||
NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE );
|
NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user