converted to use LanguageTag
Change-Id: I25c5d965d953146e91903cf2ff8e6b58f978ad20
This commit is contained in:
@@ -47,15 +47,13 @@ class UNOTOOLS_DLLPUBLIC IntlWrapper
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
::com::sun::star::lang::Locale aLocale;
|
LanguageTag aLanguageTag;
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
|
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
|
||||||
|
|
||||||
LocaleDataWrapper* pLocaleData;
|
LocaleDataWrapper* pLocaleData;
|
||||||
CollatorWrapper* pCollator;
|
CollatorWrapper* pCollator;
|
||||||
CollatorWrapper* pCaseCollator;
|
CollatorWrapper* pCaseCollator;
|
||||||
|
|
||||||
LanguageType eLanguage;
|
|
||||||
|
|
||||||
void ImplNewLocaleData() const;
|
void ImplNewLocaleData() const;
|
||||||
void ImplNewCollator( sal_Bool bCaseSensitive ) const;
|
void ImplNewCollator( sal_Bool bCaseSensitive ) const;
|
||||||
|
|
||||||
@@ -71,8 +69,8 @@ public:
|
|||||||
);
|
);
|
||||||
~IntlWrapper();
|
~IntlWrapper();
|
||||||
|
|
||||||
LanguageType getLanguage() const { return eLanguage; }
|
LanguageType getLanguage() const { return aLanguageTag.getLanguageType(); }
|
||||||
const ::com::sun::star::lang::Locale& getLocale() const { return aLocale; }
|
const ::com::sun::star::lang::Locale& getLocale() const { return aLanguageTag.getLocale(); }
|
||||||
|
|
||||||
const LocaleDataWrapper* getLocaleData() const
|
const LocaleDataWrapper* getLocaleData() const
|
||||||
{
|
{
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#define _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
|
#define _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
|
||||||
#include <tools/string.hxx>
|
#include <tools/string.hxx>
|
||||||
#include <tools/solar.h>
|
#include <tools/solar.h>
|
||||||
|
#include <i18npool/languagetag.hxx>
|
||||||
#include <com/sun/star/i18n/XExtendedTransliteration.hpp>
|
#include <com/sun/star/i18n/XExtendedTransliteration.hpp>
|
||||||
|
|
||||||
namespace com { namespace sun { namespace star {
|
namespace com { namespace sun { namespace star {
|
||||||
@@ -37,9 +38,8 @@ class UNOTOOLS_DLLPUBLIC TransliterationWrapper
|
|||||||
{
|
{
|
||||||
::com::sun::star::uno::Reference<
|
::com::sun::star::uno::Reference<
|
||||||
::com::sun::star::i18n::XExtendedTransliteration > xTrans;
|
::com::sun::star::i18n::XExtendedTransliteration > xTrans;
|
||||||
::com::sun::star::lang::Locale aLocale;
|
LanguageTag aLanguageTag;
|
||||||
sal_uInt32 nType;
|
sal_uInt32 nType;
|
||||||
sal_uInt16 nLanguage;
|
|
||||||
mutable sal_Bool bFirstCall;
|
mutable sal_Bool bFirstCall;
|
||||||
|
|
||||||
// not implemented, prevent usage
|
// not implemented, prevent usage
|
||||||
@@ -57,8 +57,8 @@ public:
|
|||||||
~TransliterationWrapper();
|
~TransliterationWrapper();
|
||||||
|
|
||||||
// get current Locale / Language
|
// get current Locale / Language
|
||||||
const ::com::sun::star::lang::Locale& getLocale() const { return aLocale;}
|
const ::com::sun::star::lang::Locale& getLocale() const { return aLanguageTag.getLocale();}
|
||||||
sal_uInt16 getLanguage() const { return nLanguage; }
|
sal_uInt16 getLanguage() const { return aLanguageTag.getLanguageType(); }
|
||||||
|
|
||||||
sal_uInt32 getType() const { return nType; }
|
sal_uInt32 getType() const { return nType; }
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include <rtl/instance.hxx>
|
#include <rtl/instance.hxx>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <i18npool/mslangid.hxx>
|
#include <i18npool/mslangid.hxx>
|
||||||
|
#include <i18npool/languagetag.hxx>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <tools/string.hxx>
|
#include <tools/string.hxx>
|
||||||
#include <unotools/lingucfg.hxx>
|
#include <unotools/lingucfg.hxx>
|
||||||
@@ -61,7 +62,7 @@ static sal_Bool lcl_SetLocale( sal_Int16 &rLanguage, const uno::Any &rVal )
|
|||||||
lang::Locale aNew;
|
lang::Locale aNew;
|
||||||
if (rVal >>= aNew) // conversion successful?
|
if (rVal >>= aNew) // conversion successful?
|
||||||
{
|
{
|
||||||
sal_Int16 nNew = MsLangId::convertLocaleToLanguage( aNew );
|
sal_Int16 nNew = LanguageTag( aNew ).getLanguageType( false);
|
||||||
if (nNew != rLanguage)
|
if (nNew != rLanguage)
|
||||||
{
|
{
|
||||||
rLanguage = nNew;
|
rLanguage = nNew;
|
||||||
@@ -75,7 +76,7 @@ static inline const OUString lcl_LanguageToCfgLocaleStr( sal_Int16 nLanguage )
|
|||||||
{
|
{
|
||||||
OUString aRes;
|
OUString aRes;
|
||||||
if (LANGUAGE_SYSTEM != nLanguage)
|
if (LANGUAGE_SYSTEM != nLanguage)
|
||||||
aRes = MsLangId::convertLanguageToIsoString( nLanguage );
|
aRes = LanguageTag( nLanguage ).getBcp47();
|
||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ static sal_Int16 lcl_CfgAnyToLanguage( const uno::Any &rVal )
|
|||||||
{
|
{
|
||||||
OUString aTmp;
|
OUString aTmp;
|
||||||
rVal >>= aTmp;
|
rVal >>= aTmp;
|
||||||
return (aTmp.isEmpty()) ? LANGUAGE_SYSTEM : MsLangId::convertIsoStringToLanguage( aTmp );
|
return (aTmp.isEmpty()) ? LANGUAGE_SYSTEM : LanguageTag( aTmp ).getLanguageType();
|
||||||
}
|
}
|
||||||
|
|
||||||
SvtLinguOptions::SvtLinguOptions()
|
SvtLinguOptions::SvtLinguOptions()
|
||||||
@@ -365,19 +366,19 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
|
|||||||
}
|
}
|
||||||
case UPH_DEFAULT_LOCALE :
|
case UPH_DEFAULT_LOCALE :
|
||||||
{
|
{
|
||||||
lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage, false ) );
|
lang::Locale aLocale( LanguageTag( rOpt.nDefaultLanguage ).getLocale( false ) );
|
||||||
aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
|
aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UPH_DEFAULT_LOCALE_CJK :
|
case UPH_DEFAULT_LOCALE_CJK :
|
||||||
{
|
{
|
||||||
lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CJK, false ) );
|
lang::Locale aLocale( LanguageTag( rOpt.nDefaultLanguage_CJK ).getLocale( false ) );
|
||||||
aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
|
aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UPH_DEFAULT_LOCALE_CTL :
|
case UPH_DEFAULT_LOCALE_CTL :
|
||||||
{
|
{
|
||||||
lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CTL, false ) );
|
lang::Locale aLocale( LanguageTag( rOpt.nDefaultLanguage_CTL ).getLocale( false ) );
|
||||||
aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
|
aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <rtl/instance.hxx>
|
#include <rtl/instance.hxx>
|
||||||
#include <rtl/logfile.hxx>
|
#include <rtl/logfile.hxx>
|
||||||
#include <i18npool/mslangid.hxx>
|
#include <i18npool/mslangid.hxx>
|
||||||
|
#include <i18npool/languagetag.hxx>
|
||||||
#include <tools/string.hxx>
|
#include <tools/string.hxx>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <unotools/syslocaleoptions.hxx>
|
#include <unotools/syslocaleoptions.hxx>
|
||||||
@@ -70,10 +71,8 @@ static com::sun::star::lang::Locale lcl_str_to_locale( const ::rtl::OUString rSt
|
|||||||
|
|
||||||
class SvtSysLocaleOptions_Impl : public utl::ConfigItem
|
class SvtSysLocaleOptions_Impl : public utl::ConfigItem
|
||||||
{
|
{
|
||||||
Locale m_aRealLocale;
|
LanguageTag m_aRealLocale;
|
||||||
Locale m_aRealUILocale;
|
LanguageTag m_aRealUILocale;
|
||||||
LanguageType m_eRealLanguage;
|
|
||||||
LanguageType m_eRealUILanguage;
|
|
||||||
OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM
|
OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM
|
||||||
OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM
|
OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM
|
||||||
OUString m_aCurrencyString; // USD-en-US or EUR-de-DE
|
OUString m_aCurrencyString; // USD-en-US or EUR-de-DE
|
||||||
@@ -122,10 +121,10 @@ public:
|
|||||||
void SetIgnoreLanguageChange( sal_Bool bSet);
|
void SetIgnoreLanguageChange( sal_Bool bSet);
|
||||||
|
|
||||||
sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
|
sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
|
||||||
const Locale& GetRealLocale() { return m_aRealLocale; }
|
const Locale& GetRealLocale() { return m_aRealLocale.getLocale(); }
|
||||||
const Locale& GetRealUILocale() { return m_aRealUILocale; }
|
const Locale& GetRealUILocale() { return m_aRealUILocale.getLocale(); }
|
||||||
LanguageType GetRealLanguage() { return m_eRealLanguage; }
|
LanguageType GetRealLanguage() { return m_eRealLanguage.getLanguageType(); }
|
||||||
LanguageType GetRealUILanguage() { return m_eRealUILanguage; }
|
LanguageType GetRealUILanguage() { return m_eRealUILanguage.getLanguageType(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -167,6 +166,8 @@ const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
|
|||||||
|
|
||||||
SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
|
SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
|
||||||
: ConfigItem( ROOTNODE_SYSLOCALE )
|
: ConfigItem( ROOTNODE_SYSLOCALE )
|
||||||
|
, m_aRealLocale( LANGUAGE_SYSTEM)
|
||||||
|
, m_aRealUILocale( LANGUAGE_SYSTEM)
|
||||||
, m_bDecimalSeparator( sal_True )
|
, m_bDecimalSeparator( sal_True )
|
||||||
, m_bROLocale(CFG_READONLY_DEFAULT)
|
, m_bROLocale(CFG_READONLY_DEFAULT)
|
||||||
, m_bROUILocale(CFG_READONLY_DEFAULT)
|
, m_bROUILocale(CFG_READONLY_DEFAULT)
|
||||||
@@ -287,30 +288,27 @@ SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl()
|
|||||||
|
|
||||||
void SvtSysLocaleOptions_Impl::MakeRealLocale()
|
void SvtSysLocaleOptions_Impl::MakeRealLocale()
|
||||||
{
|
{
|
||||||
m_aRealLocale = lcl_str_to_locale( m_aLocaleString );
|
if (m_aLocaleString.isEmpty())
|
||||||
if ( !m_aRealLocale.Language.isEmpty() )
|
|
||||||
{
|
{
|
||||||
m_eRealLanguage = MsLangId::convertLocaleToLanguage( m_aRealLocale );
|
LanguageType nLang = MsLangId::getSystemLanguage();
|
||||||
|
m_aRealLocale = LanguageTag( nLang);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_eRealLanguage = MsLangId::getSystemLanguage();
|
m_aRealLocale = LanguageTag( m_aLocaleString);
|
||||||
MsLangId::convertLanguageToLocale( m_eRealLanguage, m_aRealLocale );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvtSysLocaleOptions_Impl::MakeRealUILocale()
|
void SvtSysLocaleOptions_Impl::MakeRealUILocale()
|
||||||
{
|
{
|
||||||
// as we can't switch UILocale at runtime, we only store changes in the configuration
|
if (m_aUILocaleString.isEmpty())
|
||||||
m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString );
|
|
||||||
if ( !m_aRealUILocale.Language.isEmpty() )
|
|
||||||
{
|
{
|
||||||
m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale );
|
LanguageType nLang = MsLangId::getSystemUILanguage();
|
||||||
|
m_aRealUILocale = LanguageTag( nLang);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_eRealUILanguage = MsLangId::getSystemUILanguage();
|
m_aRealUILocale = LanguageTag( m_aUILocaleString);
|
||||||
MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +429,7 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr )
|
|||||||
{
|
{
|
||||||
m_aLocaleString = rStr;
|
m_aLocaleString = rStr;
|
||||||
MakeRealLocale();
|
MakeRealLocale();
|
||||||
MsLangId::setConfiguredSystemLanguage( m_eRealLanguage );
|
MsLangId::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() )
|
||||||
@@ -448,7 +446,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_eRealUILanguage );
|
MsLangId::setConfiguredSystemLanguage( m_aRealUILocale.getLanguageType() );
|
||||||
SetModified();
|
SetModified();
|
||||||
NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE );
|
NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE );
|
||||||
}
|
}
|
||||||
@@ -700,7 +698,7 @@ void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev,
|
|||||||
{
|
{
|
||||||
rAbbrev = rConfigString.copy( 0, nDelim );
|
rAbbrev = rConfigString.copy( 0, nDelim );
|
||||||
String aIsoStr( rConfigString.copy( nDelim+1 ) );
|
String aIsoStr( rConfigString.copy( nDelim+1 ) );
|
||||||
eLang = MsLangId::convertIsoStringToLanguage( aIsoStr );
|
eLang = LanguageTag( aIsoStr ).getLanguageType();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -714,7 +712,7 @@ void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev,
|
|||||||
::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
|
::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
|
||||||
const String& rAbbrev, LanguageType eLang )
|
const String& rAbbrev, LanguageType eLang )
|
||||||
{
|
{
|
||||||
String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) );
|
String aIsoStr( LanguageTag( eLang ).getBcp47() );
|
||||||
if ( aIsoStr.Len() )
|
if ( aIsoStr.Len() )
|
||||||
{
|
{
|
||||||
::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() );
|
::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() );
|
||||||
|
@@ -27,13 +27,12 @@ IntlWrapper::IntlWrapper(
|
|||||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
|
||||||
const ::com::sun::star::lang::Locale& rLocale )
|
const ::com::sun::star::lang::Locale& rLocale )
|
||||||
:
|
:
|
||||||
aLocale( rLocale ),
|
aLanguageTag( rLocale ),
|
||||||
xSMgr( xSF ),
|
xSMgr( xSF ),
|
||||||
pLocaleData( NULL ),
|
pLocaleData( NULL ),
|
||||||
pCollator( NULL ),
|
pCollator( NULL ),
|
||||||
pCaseCollator( NULL )
|
pCaseCollator( NULL )
|
||||||
{
|
{
|
||||||
eLanguage = MsLangId::convertLocaleToLanguage( aLocale );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,13 +40,12 @@ IntlWrapper::IntlWrapper(
|
|||||||
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
|
||||||
LanguageType eLang )
|
LanguageType eLang )
|
||||||
:
|
:
|
||||||
|
aLanguageTag( eLang ),
|
||||||
xSMgr( xSF ),
|
xSMgr( xSF ),
|
||||||
pLocaleData( NULL ),
|
pLocaleData( NULL ),
|
||||||
pCollator( NULL ),
|
pCollator( NULL ),
|
||||||
pCaseCollator( NULL ),
|
pCaseCollator( NULL )
|
||||||
eLanguage( eLang )
|
|
||||||
{
|
{
|
||||||
MsLangId::convertLanguageToLocale( eLanguage, aLocale );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +59,8 @@ IntlWrapper::~IntlWrapper()
|
|||||||
|
|
||||||
void IntlWrapper::ImplNewLocaleData() const
|
void IntlWrapper::ImplNewLocaleData() const
|
||||||
{
|
{
|
||||||
((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(xSMgr), aLocale );
|
((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper(
|
||||||
|
comphelper::getComponentContext(xSMgr), aLanguageTag.getLocale() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,12 +69,13 @@ void IntlWrapper::ImplNewCollator( sal_Bool bCaseSensitive ) const
|
|||||||
CollatorWrapper* p = new CollatorWrapper( xSMgr );
|
CollatorWrapper* p = new CollatorWrapper( xSMgr );
|
||||||
if ( bCaseSensitive )
|
if ( bCaseSensitive )
|
||||||
{
|
{
|
||||||
p->loadDefaultCollator( aLocale, 0 );
|
p->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
|
||||||
((IntlWrapper*)this)->pCaseCollator = p;
|
((IntlWrapper*)this)->pCaseCollator = p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->loadDefaultCollator( aLocale, ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
|
p->loadDefaultCollator( aLanguageTag.getLocale(),
|
||||||
|
::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
|
||||||
((IntlWrapper*)this)->pCollator = p;
|
((IntlWrapper*)this)->pCollator = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
#include <unotools/digitgroupingiterator.hxx>
|
#include <unotools/digitgroupingiterator.hxx>
|
||||||
#include <tools/string.hxx>
|
#include <tools/string.hxx>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <i18npool/mslangid.hxx>
|
#include <i18npool/languagetag.hxx>
|
||||||
|
|
||||||
#include "instance.hxx"
|
#include "instance.hxx"
|
||||||
#include <com/sun/star/i18n/KNumberFormatUsage.hpp>
|
#include <com/sun/star/i18n/KNumberFormatUsage.hpp>
|
||||||
@@ -299,7 +299,7 @@ void LocaleDataWrapper::invalidateData()
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LanguageType eLang = MsLangId::convertLocaleToLanguage( xLoc[i] );
|
LanguageType eLang = LanguageTag( xLoc[i] ).getLanguageType();
|
||||||
|
|
||||||
// In checks, exclude known problems because no MS-LCID defined.
|
// In checks, exclude known problems because no MS-LCID defined.
|
||||||
if (areChecksEnabled() && eLang == LANGUAGE_DONTKNOW)
|
if (areChecksEnabled() && eLang == LANGUAGE_DONTKNOW)
|
||||||
@@ -317,10 +317,10 @@ void LocaleDataWrapper::invalidateData()
|
|||||||
}
|
}
|
||||||
if ( eLang != LANGUAGE_DONTKNOW )
|
if ( eLang != LANGUAGE_DONTKNOW )
|
||||||
{
|
{
|
||||||
rtl::OUString aLanguage, aCountry;
|
LanguageTag aLanguageTag( eLang);
|
||||||
MsLangId::convertLanguageToIsoNames( eLang, aLanguage, aCountry );
|
lang::Locale aLocale = aLanguageTag.getLocale();
|
||||||
if ( xLoc[i].Language != aLanguage ||
|
if ( xLoc[i].Language != aLocale.Language ||
|
||||||
xLoc[i].Country != aCountry )
|
xLoc[i].Country != aLocale.Country )
|
||||||
{
|
{
|
||||||
// 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.
|
||||||
@@ -338,12 +338,7 @@ void LocaleDataWrapper::invalidateData()
|
|||||||
aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM( " -> 0x"));
|
aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM( " -> 0x"));
|
||||||
aMsg.append(static_cast<sal_Int32>(eLang), 16);
|
aMsg.append(static_cast<sal_Int32>(eLang), 16);
|
||||||
aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM( " -> "));
|
aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM( " -> "));
|
||||||
aMsg.append(aLanguage);
|
aMsg.append(aLanguageTag.getBcp47());
|
||||||
if ( !aCountry.isEmpty() )
|
|
||||||
{
|
|
||||||
aMsg.append('_');
|
|
||||||
aMsg.append(aCountry);
|
|
||||||
}
|
|
||||||
outputCheckMessage( aMsg.makeStringAndClear() );
|
outputCheckMessage( aMsg.makeStringAndClear() );
|
||||||
}
|
}
|
||||||
eLang = LANGUAGE_DONTKNOW;
|
eLang = LANGUAGE_DONTKNOW;
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <i18npool/mslangid.hxx>
|
#include <i18npool/languagetag.hxx>
|
||||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||||
#include <com/sun/star/util/TextSearch.hpp>
|
#include <com/sun/star/util/TextSearch.hpp>
|
||||||
#include <com/sun/star/util/SearchFlags.hpp>
|
#include <com/sun/star/util/SearchFlags.hpp>
|
||||||
@@ -125,8 +125,7 @@ TextSearch::TextSearch(const SearchParam & rParam, LanguageType eLang )
|
|||||||
{
|
{
|
||||||
if( LANGUAGE_NONE == eLang )
|
if( LANGUAGE_NONE == eLang )
|
||||||
eLang = LANGUAGE_SYSTEM;
|
eLang = LANGUAGE_SYSTEM;
|
||||||
::com::sun::star::lang::Locale aLocale(
|
::com::sun::star::lang::Locale aLocale( LanguageTag( eLang ).getLocale() );
|
||||||
MsLangId::convertLanguageToLocale( LanguageType(eLang)));
|
|
||||||
|
|
||||||
Init( rParam, aLocale);
|
Init( rParam, aLocale);
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <unotools/transliterationwrapper.hxx>
|
#include <unotools/transliterationwrapper.hxx>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <i18npool/mslangid.hxx>
|
#include <i18npool/languagetag.hxx>
|
||||||
|
|
||||||
#include "instance.hxx"
|
#include "instance.hxx"
|
||||||
#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
|
#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
|
||||||
@@ -34,8 +34,8 @@ using namespace ::utl;
|
|||||||
TransliterationWrapper::TransliterationWrapper(
|
TransliterationWrapper::TransliterationWrapper(
|
||||||
const Reference< XComponentContext > & rxContext,
|
const Reference< XComponentContext > & rxContext,
|
||||||
sal_uInt32 nTyp )
|
sal_uInt32 nTyp )
|
||||||
: xTrans( Transliteration::create(rxContext) ), nType( nTyp ),
|
: xTrans( Transliteration::create(rxContext) ),
|
||||||
nLanguage( 0 ), bFirstCall( sal_True )
|
aLanguageTag( LANGUAGE_SYSTEM ), nType( nTyp ), bFirstCall( sal_True )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,10 +107,9 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const
|
|||||||
|
|
||||||
void TransliterationWrapper::setLanguageLocaleImpl( sal_uInt16 nLang )
|
void TransliterationWrapper::setLanguageLocaleImpl( sal_uInt16 nLang )
|
||||||
{
|
{
|
||||||
nLanguage = nLang;
|
if( LANGUAGE_NONE == nLang )
|
||||||
if( LANGUAGE_NONE == nLanguage )
|
nLang = LANGUAGE_SYSTEM;
|
||||||
nLanguage = LANGUAGE_SYSTEM;
|
aLanguageTag = LanguageTag( nLang);
|
||||||
MsLangId::convertLanguageToLocale( nLanguage, aLocale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +135,7 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( nLanguage != nLang )
|
if( aLanguageTag.getLanguageType() != nLang )
|
||||||
{
|
{
|
||||||
setLanguageLocaleImpl( nLang );
|
setLanguageLocaleImpl( nLang );
|
||||||
if( !bLoad )
|
if( !bLoad )
|
||||||
@@ -156,7 +155,7 @@ void TransliterationWrapper::loadModuleImpl() const
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( xTrans.is() )
|
if ( xTrans.is() )
|
||||||
xTrans->loadModule( (TransliterationModules)nType, aLocale );
|
xTrans->loadModule( (TransliterationModules)nType, aLanguageTag.getLocale() );
|
||||||
}
|
}
|
||||||
catch ( const Exception& e )
|
catch ( const Exception& e )
|
||||||
{
|
{
|
||||||
@@ -173,9 +172,10 @@ void TransliterationWrapper::loadModuleByImplName(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
setLanguageLocaleImpl( nLang );
|
setLanguageLocaleImpl( nLang );
|
||||||
// Reset LanguageType, so the next call to loadModuleIfNeeded() forces
|
com::sun::star::lang::Locale aLocale( aLanguageTag.getLocale());
|
||||||
|
// Reset LanguageTag, so the next call to loadModuleIfNeeded() forces
|
||||||
// new settings.
|
// new settings.
|
||||||
nLanguage = LANGUAGE_DONTKNOW;
|
aLanguageTag = LanguageTag( LANGUAGE_DONTKNOW);
|
||||||
if ( xTrans.is() )
|
if ( xTrans.is() )
|
||||||
xTrans->loadModuleByImplName( rModuleName, aLocale );
|
xTrans->loadModuleByImplName( rModuleName, aLocale );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user