diff options
72 files changed, 151 insertions, 237 deletions
diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx index 81e675daaab3..5487bda2686f 100644 --- a/accessibility/source/helper/accresmgr.cxx +++ b/accessibility/source/helper/accresmgr.cxx @@ -43,9 +43,7 @@ void TkResMgr::ensureImplExists() if (m_pImpl) return; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - - m_pImpl = SimpleResMgr::Create("acc", aLocale ); + m_pImpl = SimpleResMgr::Create("acc", Application::GetSettings().GetUILanguageTag() ); if (m_pImpl) { diff --git a/avmedia/source/framework/mediamisc.cxx b/avmedia/source/framework/mediamisc.cxx index 87468d8bd0cb..686a22bf1936 100644 --- a/avmedia/source/framework/mediamisc.cxx +++ b/avmedia/source/framework/mediamisc.cxx @@ -29,7 +29,7 @@ ResMgr* GetResMgr() if( !pResMgr ) { - pResMgr = ResMgr::CreateResMgr("avmedia", Application::GetSettings().GetUILanguageTag().getLocale()); + pResMgr = ResMgr::CreateResMgr("avmedia", Application::GetSettings().GetUILanguageTag()); } return pResMgr; diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index e88f1bbefb31..82a311d7eb8a 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -127,8 +127,7 @@ Dll::Dll () : (void)pFact; ResMgr* pMgr = ResMgr::CreateResMgr( - "basctl", Application::GetSettings().GetUILanguageTag().getLocale() - ); + "basctl", Application::GetSettings().GetUILanguageTag()); Module::Get() = new Module( pMgr, &DocShell::Factory() ); diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx index 6a8b37d38326..59be1072d676 100644 --- a/basic/source/runtime/basrdll.cxx +++ b/basic/source/runtime/basrdll.cxx @@ -36,8 +36,7 @@ BasResId::BasResId( sal_uInt32 nId ) : BasicDLL::BasicDLL() { BASIC_DLL() = this; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - pBasResMgr = ResMgr::CreateResMgr("sb", aLocale ); + pBasResMgr = ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag() ); bDebugMode = false; bBreakEnabled = true; } diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 68faaf0c81f7..ff6109ee0c9c 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -656,8 +656,7 @@ ResMgr* implGetResMgr( void ) static ResMgr* pResMgr = NULL; if( !pResMgr ) { - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - pResMgr = ResMgr::CreateResMgr("sb", aLocale ); + pResMgr = ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag() ); } return pResMgr; } diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index bca33d8f9e02..8d2091d3fa03 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -70,8 +70,7 @@ using namespace ::com::sun::star::ui::dialogs; static String impl_getSvtResString( sal_uInt32 nId ) { String aRet; - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale ); + ResMgr* pMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag() ); if( pMgr ) { aRet = String( ResId( nId, *pMgr ) ); diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx index 43c6e6eefdbe..a2997915bbe8 100644 --- a/cui/source/dialogs/pastedlg.cxx +++ b/cui/source/dialogs/pastedlg.cxx @@ -199,8 +199,7 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper, if( !aTypeName.Len() && !aSourceName.Len() ) { - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale ); + ResMgr* pMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag() ); // global resource from svtools (former so3 resource) if( pMgr ) aSourceName = String( ResId( STR_UNKNOWN_SOURCE, *pMgr ) ); diff --git a/cui/source/factory/cuiresmgr.cxx b/cui/source/factory/cuiresmgr.cxx index cd882e2a7eaa..318ce4dcf46d 100644 --- a/cui/source/factory/cuiresmgr.cxx +++ b/cui/source/factory/cuiresmgr.cxx @@ -28,7 +28,7 @@ ResMgr* CuiResMgr::GetResMgr() if ( !pResMgr ) { - pResMgr = ResMgr::CreateResMgr("cui", Application::GetSettings().GetUILanguageTag().getLocale()); + pResMgr = ResMgr::CreateResMgr("cui", Application::GetSettings().GetUILanguageTag()); } return pResMgr; diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx index 6c3e6f422f5c..01284eb516ec 100644 --- a/dbaccess/source/core/resource/core_resource.cxx +++ b/dbaccess/source/core/resource/core_resource.cxx @@ -50,9 +50,7 @@ namespace dbaccess if (m_pImpl) return; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - - m_pImpl = ResMgr::CreateResMgr("dba", aLocale); + m_pImpl = ResMgr::CreateResMgr("dba", Application::GetSettings().GetUILanguageTag()); } //------------------------------------------------------------------ diff --git a/desktop/Library_deploymentmisc.mk b/desktop/Library_deploymentmisc.mk index 544ebc348589..f0c01dc69dd6 100644 --- a/desktop/Library_deploymentmisc.mk +++ b/desktop/Library_deploymentmisc.mk @@ -50,6 +50,7 @@ $(eval $(call gb_Library_use_libraries,deploymentmisc,\ ucbhelper \ utl \ xmlscript \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/desktop/Library_unopkgapp.mk b/desktop/Library_unopkgapp.mk index a0f678ab162b..8f79d0ffe64d 100644 --- a/desktop/Library_unopkgapp.mk +++ b/desktop/Library_unopkgapp.mk @@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,unopkgapp,\ ucbhelper \ utl \ vcl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e9301bf6f9ec..3eb4ab10305b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -340,9 +340,7 @@ ResMgr* Desktop::GetDesktopResManager() OUString aUILocaleString = LanguageSelection::getLanguageString(); LanguageTag aLanguageTag( aUILocaleString); //! ResMgr may modify the Locale for fallback! - ::com::sun::star::lang::Locale aLocale( aLanguageTag.getLocale()); - Desktop::pResMgr = ResMgr::SearchCreateResMgr( "dkt", aLocale); - aLanguageTag.reset( aLocale); + Desktop::pResMgr = ResMgr::SearchCreateResMgr( "dkt", aLanguageTag); AllSettings as = GetSettings(); as.SetUILanguageTag(aLanguageTag); SetSettings(as); @@ -1495,7 +1493,7 @@ int Desktop::Main() } // create title string - ::com::sun::star::lang::Locale aLocale; + LanguageTag aLocale( LANGUAGE_SYSTEM); ResMgr* pLabelResMgr = ResMgr::SearchCreateResMgr( "ofa", aLocale ); String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String(); delete pLabelResMgr; diff --git a/desktop/source/deployment/misc/dp_resource.cxx b/desktop/source/deployment/misc/dp_resource.cxx index 0cf266e9102b..2073578e1988 100644 --- a/desktop/source/deployment/misc/dp_resource.cxx +++ b/desktop/source/deployment/misc/dp_resource.cxx @@ -51,7 +51,7 @@ struct OfficeLocale : struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr> { ResMgr * operator () () { - return ResMgr::CreateResMgr( "deployment", getOfficeLocale() ); + return ResMgr::CreateResMgr( "deployment", LanguageTag( OfficeLocale::get()) ); } }; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 06f5eac909d0..5108ecc18cd7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -68,10 +68,10 @@ static void force_c_locale( void ) { // force locale (and resource files loaded) to en-US - css::lang::Locale aLocale( "en", "US", ""); + OUString aLangISO( "en-US" ); + LanguageTag aLocale( aLangISO ); ResMgr::SetDefaultLocale( aLocale ); SvtSysLocaleOptions aLocalOptions; - OUString aLangISO( "en-US" ); aLocalOptions.SetLocaleConfigString( aLangISO ); aLocalOptions.SetUILocaleConfigString( aLangISO ); } diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 3a782ca75ffe..3368f75300bf 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -162,7 +162,7 @@ void CommandEnvironmentImpl::printLicense( Reference< css::i18n::XCollator > xCollator = css::i18n::Collator::create( m_xComponentContext ); xCollator->loadDefaultCollator( - toLocale(utl::ConfigManager::getLocale()), + LanguageTag(utl::ConfigManager::getLocale()).getLocale(), css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE); do diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 93afa9091e0e..4340e9f8c30a 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -25,26 +25,17 @@ #include "tools/resmgr.hxx" #include "rtl/ustring.hxx" #include "unotools/configmgr.hxx" +#include <i18npool/languagetag.hxx> #define APP_NAME "unopkg" namespace unopkg { - inline ::com::sun::star::lang::Locale toLocale( ::rtl::OUString const & slang ) - { - ::com::sun::star::lang::Locale locale; - sal_Int32 nIndex = 0; - locale.Language = slang.getToken( 0, '-', nIndex ); - locale.Country = slang.getToken( 0, '-', nIndex ); - locale.Variant = slang.getToken( 0, '-', nIndex ); - return locale; - } - struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr > { ResMgr * operator () () { return ResMgr::CreateResMgr( - "deployment", toLocale( utl::ConfigManager::getLocale() ) ); + "deployment", LanguageTag( utl::ConfigManager::getLocale() ) ); } }; diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 0ad2efce6a99..59086ea31666 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -204,7 +204,7 @@ EditResId::EditResId( sal_uInt16 nId ): EditDLL::EditDLL() { pGlobalData = new GlobalEditData; - pResMgr = ResMgr::CreateResMgr( "editeng", Application::GetSettings().GetUILanguageTag().getLocale() ); + pResMgr = ResMgr::CreateResMgr( "editeng", Application::GetSettings().GetUILanguageTag() ); } EditDLL::~EditDLL() diff --git a/extensions/Library_abp.mk b/extensions/Library_abp.mk index 2ecbd0cd1612..c8d0570b021c 100644 --- a/extensions/Library_abp.mk +++ b/extensions/Library_abp.mk @@ -87,6 +87,7 @@ $(eval $(call gb_Library_use_libraries,abp,\ tl \ utl \ vcl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/extensions/Library_bib.mk b/extensions/Library_bib.mk index 6de36bc9ba2e..d12adecf10d3 100644 --- a/extensions/Library_bib.mk +++ b/extensions/Library_bib.mk @@ -76,6 +76,7 @@ $(eval $(call gb_Library_use_libraries,bib,\ cppu \ sal \ salhelper \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/extensions/Library_dbp.mk b/extensions/Library_dbp.mk index 07674449c31f..42ea5a087808 100644 --- a/extensions/Library_dbp.mk +++ b/extensions/Library_dbp.mk @@ -72,6 +72,7 @@ $(eval $(call gb_Library_use_libraries,dbp,\ cppu \ sal \ salhelper \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/extensions/Library_scn.mk b/extensions/Library_scn.mk index 26d6f44af6b2..be21b7875195 100644 --- a/extensions/Library_scn.mk +++ b/extensions/Library_scn.mk @@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_libraries,scn,\ cppuhelper \ cppu \ sal \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/extensions/source/resource/oooresourceloader.cxx b/extensions/source/resource/oooresourceloader.cxx index 25900c823f62..72930af8bab2 100644 --- a/extensions/source/resource/oooresourceloader.cxx +++ b/extensions/source/resource/oooresourceloader.cxx @@ -193,7 +193,8 @@ namespace extensions { namespace resource ,m_pResourceManager( NULL ) { ::rtl::OUString sBaseName( _rBaseName ); - m_pResourceManager = new SimpleResMgr( rtl::OUStringToOString( sBaseName, RTL_TEXTENCODING_UTF8 ).getStr(), m_aLocale ); + m_pResourceManager = new SimpleResMgr( rtl::OUStringToOString( sBaseName, RTL_TEXTENCODING_UTF8 ).getStr(), + LanguageTag( m_aLocale) ); if ( !m_pResourceManager->IsValid() ) { diff --git a/filter/Library_t602filter.mk b/filter/Library_t602filter.mk index a0acfe30b668..dae8f629737d 100644 --- a/filter/Library_t602filter.mk +++ b/filter/Library_t602filter.mk @@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_libraries,t602filter,\ cppuhelper \ cppu \ sal \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx index 83c8f6f0fa6c..5d3201efdf0b 100644 --- a/filter/source/flash/swfdialog.cxx +++ b/filter/source/flash/swfdialog.cxx @@ -91,7 +91,7 @@ Reference< XInterface > SAL_CALL SWFDialog_createInstance( const Reference< XMul SWFDialog::SWFDialog( const Reference< XComponentContext> &rxContext ) : OGenericUnoDialog( rxContext ) { - mpResMgr = ResMgr::CreateResMgr( "flash", Application::GetSettings().GetUILanguageTag().getLocale() ); + mpResMgr = ResMgr::CreateResMgr( "flash", Application::GetSettings().GetUILanguageTag() ); } // ----------------------------------------------------------------------------- diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 47d678e73ad0..6f73da12db42 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -294,7 +294,7 @@ sal_Bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Fi { ResMgr* pResMgr; - pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag().getLocale() ); + pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag() ); if( pResMgr ) { @@ -435,7 +435,7 @@ sal_Bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Fi if ( mbStatus && mnLevelWarning && pFilterConfigItem ) { ResMgr* pResMgr; - pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag().getLocale() ); + pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag() ); if( pResMgr ) { InfoBox aInfoBox( NULL, String( ResId( KEY_VERSION_CHECK, *pResMgr ) ) ); diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index b95f3419a6f3..a826db3e51c7 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -41,7 +41,7 @@ static ResMgr& getPDFFilterResMgr() { - static ResMgr *pRes = ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILanguageTag().getLocale()); + static ResMgr *pRes = ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILanguageTag()); return *pRes; } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 6eea76df9db0..75e698391a3b 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -882,7 +882,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue if ( mxStatusIndicator.is() ) { - ResMgr* pResMgr = ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILanguageTag().getLocale() ); + ResMgr* pResMgr = ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILanguageTag() ); if ( pResMgr ) { sal_Int32 nTotalPageCount = aRangeEnum.size(); diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 0282d19f8657..d72401f73cbb 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -1123,7 +1123,7 @@ void T602ImportFilterDialog::initLocale() rtl::OString aModName( "t602filter" ); aModName += rtl::OString::valueOf( sal_Int32( SUPD ) ); - mpResMgr = ResMgr::CreateResMgr( aModName.getStr(), meLocale ); + mpResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( meLocale) ); } ResMgr* T602ImportFilterDialog::getResMgr() diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 1e21a7abad88..229e4cf26c15 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -349,7 +349,7 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException) if( NULL == pXSLTResMgr ) { - pXSLTResMgr = ResMgr::CreateResMgr( "xsltdlg", Application::GetSettings().GetUILanguageTag().getLocale() ); + pXSLTResMgr = ResMgr::CreateResMgr( "xsltdlg", Application::GetSettings().GetUILanguageTag() ); } if( NULL == mpDialog ) diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx index c269de8e4654..9acd6b1c3fc8 100644 --- a/forms/source/resource/frm_resource.cxx +++ b/forms/source/resource/frm_resource.cxx @@ -48,7 +48,7 @@ namespace frm if (m_pImpl) return; - m_pImpl = SimpleResMgr::Create("frm", Application::GetSettings().GetUILanguageTag().getLocale()); + m_pImpl = SimpleResMgr::Create("frm", Application::GetSettings().GetUILanguageTag()); if (m_pImpl) { diff --git a/formula/Library_forui.mk b/formula/Library_forui.mk index 130e621ba893..0706a40a28bc 100644 --- a/formula/Library_forui.mk +++ b/formula/Library_forui.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Library_use_libraries,forui,\ tl \ utl \ vcl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/formula/source/core/resource/core_resource.cxx b/formula/source/core/resource/core_resource.cxx index 63279d2db7ff..3e7160a48957 100644 --- a/formula/source/core/resource/core_resource.cxx +++ b/formula/source/core/resource/core_resource.cxx @@ -47,9 +47,7 @@ namespace formula if (m_pImpl) return; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - - m_pImpl = ResMgr::CreateResMgr("for", aLocale); + m_pImpl = ResMgr::CreateResMgr("for", Application::GetSettings().GetUILanguageTag()); } //------------------------------------------------------------------------- diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk index 10b6d065f9c5..f9c69ea7484b 100644 --- a/fpicker/Library_fps_office.mk +++ b/fpicker/Library_fps_office.mk @@ -50,6 +50,7 @@ $(eval $(call gb_Library_use_libraries,fps_office,\ ucbhelper \ utl \ vcl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/fpicker/source/win32/misc/resourceprovider.cxx b/fpicker/source/win32/misc/resourceprovider.cxx index 6ecbae53dade..4e4cc9e0a9e7 100644 --- a/fpicker/source/win32/misc/resourceprovider.cxx +++ b/fpicker/source/win32/misc/resourceprovider.cxx @@ -107,7 +107,7 @@ public: { const SolarMutexGuard aGuard; m_ResMgr = new SimpleResMgr( - "fps_office", Application::GetSettings().GetUILanguageTag().getLocale()); + "fps_office", Application::GetSettings().GetUILanguageTag()); } //------------------------------------- diff --git a/framework/source/classes/fwlresid.cxx b/framework/source/classes/fwlresid.cxx index ba3987a0c01d..ff01b34561c2 100644 --- a/framework/source/classes/fwlresid.cxx +++ b/framework/source/classes/fwlresid.cxx @@ -34,7 +34,7 @@ ResMgr* FwlResId::GetResManager() if ( !pResMgr ) { SolarMutexGuard aSolarGuard; - pResMgr = ResMgr::CreateResMgr("fwe", Application::GetSettings().GetUILanguageTag().getLocale()); + pResMgr = ResMgr::CreateResMgr("fwe", Application::GetSettings().GetUILanguageTag()); } return pResMgr; diff --git a/framework/source/fwe/classes/fwkresid.cxx b/framework/source/fwe/classes/fwkresid.cxx index ff78bb393238..0ae4d3e579ad 100644 --- a/framework/source/fwe/classes/fwkresid.cxx +++ b/framework/source/fwe/classes/fwkresid.cxx @@ -34,7 +34,7 @@ ResMgr* FwkResId::GetResManager() if ( !pResMgr ) { SolarMutexGuard aSolarGuard; - pResMgr = ResMgr::CreateResMgr("fwe", Application::GetSettings().GetUILanguageTag().getLocale()); + pResMgr = ResMgr::CreateResMgr("fwe", Application::GetSettings().GetUILanguageTag()); } return pResMgr; diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx index 41db42bf11b1..56f6ac4c4b67 100644 --- a/framework/source/services/license.cxx +++ b/framework/source/services/license.cxx @@ -220,21 +220,9 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na aRet <<= sal_False; return aRet; } - // determine the filename of the license to show - AllSettings aSettings(Application::GetSettings()); - ::com::sun::star::lang::Locale aLocale = aSettings.GetUILanguageTag().getLocale(); - OUString aLangString = aLocale.Language; - if ( !aLocale.Country.isEmpty() ) - { - aLangString += ::rtl::OUString("-"); - aLangString += aLocale.Country; - if ( !aLocale.Variant.isEmpty() ) - { - aLangString += ::rtl::OUString("-"); - aLangString += aLocale.Variant; - } - } + // determine the filename of the license to show + OUString aLangString( Application::GetSettings().GetUILanguageTag().getBcp47()); #if defined(WNT) ::rtl::OUString aLicensePath = aBaseInstallPath + ::rtl::OUString::createFromAscii(szLicensePath) @@ -292,7 +280,8 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na } // prepare to show // display license dialog - boost::scoped_ptr<ResMgr> pResMgr(ResMgr::SearchCreateResMgr("fwe", aLocale)); + LanguageTag aLanguageTag( Application::GetSettings().GetUILanguageTag()); + boost::scoped_ptr<ResMgr> pResMgr( ResMgr::SearchCreateResMgr("fwe", aLanguageTag)); boost::scoped_ptr<LicenseDialog> pDialog(new LicenseDialog(aLicensePath, pResMgr.get())); sal_Bool bAgreed = (pDialog->Execute() == 1); diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 692fb98c07ef..42de11ea3ffa 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -202,7 +202,7 @@ ControlMenuController::~ControlMenuController() // private function void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu ) { - ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag().getLocale()); + ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag()); ResId aResId( RID_SVXIMGLIST_FMEXPL, *pResMgr ); aResId.SetRT( RSC_IMAGELIST ); @@ -351,7 +351,7 @@ void ControlMenuController::impl_setPopupMenu() { if ( m_pResPopupMenu == 0 ) { - ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag().getLocale()); + ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag()); if ( pResMgr ) { ResId aResId( RID_FMSHELL_CONVERSIONMENU, *pResMgr ); diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 69c5631fa2e5..8e16ca406710 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -54,7 +54,7 @@ ResId padmin::PaResId( sal_uInt32 nId ) static ResMgr* pPaResMgr = NULL; if( ! pPaResMgr ) { - ::com::sun::star::lang::Locale aLocale; + LanguageTag aLanguageTag( LANGUAGE_SYSTEM); utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext( @@ -66,16 +66,12 @@ ResId padmin::PaResId( sal_uInt32 nId ) Any aValue = aNode.getNodeValue( OUString("ooLocale") ); if( aValue >>= aLoc ) { - /* FIXME-BCP47: handle language tags! */ - sal_Int32 nIndex = 0; - aLocale.Language = aLoc.getToken( 0, '-', nIndex ); - aLocale.Country = aLoc.getToken( 0, '-', nIndex ); - aLocale.Variant = aLoc.getToken( 0, '-', nIndex ); + aLanguageTag.reset( aLoc); } } - pPaResMgr = ResMgr::SearchCreateResMgr( "spa", aLocale ); + pPaResMgr = ResMgr::SearchCreateResMgr( "spa", aLanguageTag ); AllSettings aSettings = Application::GetSettings(); - aSettings.SetUILanguageTag( LanguageTag( aLocale) ); + aSettings.SetUILanguageTag( aLanguageTag ); Application::SetSettings( aSettings ); } return ResId( nId, *pPaResMgr ); diff --git a/reportdesign/source/core/resource/core_resource.cxx b/reportdesign/source/core/resource/core_resource.cxx index df12dd0dcb1e..0abc584d5017 100644 --- a/reportdesign/source/core/resource/core_resource.cxx +++ b/reportdesign/source/core/resource/core_resource.cxx @@ -54,9 +54,7 @@ namespace reportdesign // now that we have an impl class make sure it's deleted on unloading the library static ResourceManager::EnsureDelete s_aDeleteTheImplClass; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - - m_pImpl = SimpleResMgr::Create("rpt", aLocale); + m_pImpl = SimpleResMgr::Create("rpt", Application::GetSettings().GetUILanguageTag()); } } diff --git a/scaddins/Library_analysis.mk b/scaddins/Library_analysis.mk index 2b91e97bbc15..e502efd65f27 100644 --- a/scaddins/Library_analysis.mk +++ b/scaddins/Library_analysis.mk @@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,analysis,\ cppuhelper \ sal \ tl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/scaddins/Library_date.mk b/scaddins/Library_date.mk index 008212dfec50..d9fb4d3c9e91 100644 --- a/scaddins/Library_date.mk +++ b/scaddins/Library_date.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Library_use_libraries,date,\ cppuhelper \ sal \ tl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/scaddins/Library_pricing.mk b/scaddins/Library_pricing.mk index d03a90b936aa..12d8032921ec 100644 --- a/scaddins/Library_pricing.mk +++ b/scaddins/Library_pricing.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Library_use_libraries,pricing,\ cppuhelper \ sal \ tl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index 2a335f83215f..e8880fab3172 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -138,7 +138,7 @@ void AnalysisAddIn::InitData( void ) delete pResMgr; OString aModName( "analysis" ); - pResMgr = ResMgr::CreateResMgr( aModName.getStr(), aFuncLoc ); + pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) ); if( pFD ) delete pFD; diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index 378db18cb192..37941045a751 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -297,7 +297,7 @@ void ScaDateAddIn::InitData() delete pResMgr; OString aModName( "date" ); - pResMgr = ResMgr::CreateResMgr( aModName.getStr(), aFuncLoc ); + pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) ); if( pFuncDataList ) delete pFuncDataList; diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index 2d7a8c8ca7f8..cc1a30cc2073 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -301,7 +301,7 @@ void ScaPricingAddIn::InitData() delete pResMgr; OString aModName( "pricing" ); - pResMgr = ResMgr::CreateResMgr( aModName.getStr(), aFuncLoc ); + pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) ); if( pFuncDataList ) delete pFuncDataList; diff --git a/sccomp/Library_solver.mk b/sccomp/Library_solver.mk index d0a56c222636..5561cc76f48b 100644 --- a/sccomp/Library_solver.mk +++ b/sccomp/Library_solver.mk @@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_libraries,solver,\ cppuhelper \ sal \ tl \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/svl/inc/svl/inettype.hxx b/svl/inc/svl/inettype.hxx index 976452882372..a68d7911d37c 100644 --- a/svl/inc/svl/inettype.hxx +++ b/svl/inc/svl/inettype.hxx @@ -22,7 +22,7 @@ #include "svl/svldllapi.h" #include <tools/inetmime.hxx> -#include <com/sun/star/lang/Locale.hpp> +#include <i18npool/languagetag.hxx> //============================================================================ /** Definitions for frequently used media type names. @@ -259,7 +259,7 @@ public: static rtl::OUString GetContentType(INetContentType eTypeID); static OUString GetPresentation(INetContentType eTypeID, - const ::com::sun::star::lang::Locale& aLocale); + const LanguageTag& aLocale); static INetContentType GetContentType4Extension(OUString const & rExtension); diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx index 7d3da748c61d..b62254c4bf72 100644 --- a/svl/source/items/ctypeitm.cxx +++ b/svl/source/items/ctypeitm.cxx @@ -157,7 +157,7 @@ SfxItemPresentation CntContentTypeItem::GetPresentation( if (pIntlWrapper) (const_cast< CntContentTypeItem * >(this))->_aPresentation = INetContentTypes::GetPresentation(GetEnumValue(), - pIntlWrapper->getLanguageTag().getLocale()); + pIntlWrapper->getLanguageTag()); } if (!_aPresentation.isEmpty()) { diff --git a/svl/source/misc/getstringresource.cxx b/svl/source/misc/getstringresource.cxx index 22d5cad97847..866fd8f7d188 100644 --- a/svl/source/misc/getstringresource.cxx +++ b/svl/source/misc/getstringresource.cxx @@ -23,7 +23,7 @@ #include "boost/noncopyable.hpp" #include "boost/scoped_ptr.hpp" -#include "com/sun/star/lang/Locale.hpp" +#include <i18npool/languagetag.hxx> #include "rtl/instance.hxx" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.hxx" @@ -39,7 +39,7 @@ class ResMgrMap: private boost::noncopyable { public: ~ResMgrMap(); - SimpleResMgr * get(css::lang::Locale const & locale); + SimpleResMgr * get(LanguageTag const & locale); private: typedef std::map< rtl::OUString, SimpleResMgr * > Map; @@ -58,11 +58,8 @@ ResMgrMap::~ResMgrMap() { } } -SimpleResMgr * ResMgrMap::get(css::lang::Locale const & locale) { - rtl::OUStringBuffer buf(locale.Language); - buf.append(sal_Unicode('-')); - buf.append(locale.Country); - rtl::OUString code(buf.makeStringAndClear()); +SimpleResMgr * ResMgrMap::get(LanguageTag const & locale) { + OUString code( locale.getBcp47()); Map::iterator i(map_.find(code)); if (i == map_.end()) { boost::scoped_ptr< SimpleResMgr > mgr( @@ -79,7 +76,7 @@ struct theResMgrMap: public rtl::Static< ResMgrMap, theResMgrMap > {}; namespace svl { -rtl::OUString getStringResource(sal_uInt16 id, css::lang::Locale const & locale) +rtl::OUString getStringResource(sal_uInt16 id, LanguageTag const & locale) { return theResMgrMap::get().get(locale)->ReadString(id); } diff --git a/svl/source/misc/getstringresource.hxx b/svl/source/misc/getstringresource.hxx index 254765be44fe..1410c1577e99 100644 --- a/svl/source/misc/getstringresource.hxx +++ b/svl/source/misc/getstringresource.hxx @@ -32,7 +32,7 @@ namespace rtl { class OUString; } namespace svl { rtl::OUString getStringResource( - sal_uInt16 id, com::sun::star::lang::Locale const & locale); + sal_uInt16 id, LanguageTag const & locale); } diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index becc31548872..36878223b912 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -737,7 +737,7 @@ OUString INetContentTypes::GetContentType(INetContentType eTypeID) //============================================================================ //static OUString INetContentTypes::GetPresentation(INetContentType eTypeID, - const ::com::sun::star::lang::Locale& aLocale) + const LanguageTag& aLocale) { sal_uInt16 nResID = sal_uInt16(); if (eTypeID <= CONTENT_TYPE_LAST) diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx index 76d867634838..dd4aae281288 100644 --- a/svtools/source/contnr/DocumentInfoPreview.cxx +++ b/svtools/source/contnr/DocumentInfoPreview.cxx @@ -91,7 +91,7 @@ void ODocumentInfoPreview::fill( } else { - insertNonempty( DI_MIMETYPE, INetContentTypes::GetPresentation(eTypeID, m_aLocale)); + insertNonempty( DI_MIMETYPE, INetContentTypes::GetPresentation(eTypeID, LanguageTag(m_aLocale))); } } diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx index 4f81901dd511..c85de6f330f0 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter/SvFilterOptionsDialog.cxx @@ -210,7 +210,7 @@ sal_Int16 SvFilterOptionsDialog::execute() ResMgr* pResMgr; - pResMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag().getLocale() ); + pResMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag() ); aFltCallDlgPara.pResMgr = pResMgr; aFltCallDlgPara.aFilterExt = aGraphicFilter.GetExportFormatShortName( nFormat ); diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index c8e98e20088d..e7435569d400 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -280,7 +280,7 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const : rtl::OString aResMgrName(rtl::OUStringToOString( rResourceURL.getToken(0, '/', nIndex), RTL_TEXTENCODING_ASCII_US)); - ResMgr* pResMgr = ResMgr::CreateResMgr( aResMgrName.getStr(), Application::GetSettings().GetUILanguageTag().getLocale() ); + ResMgr* pResMgr = ResMgr::CreateResMgr( aResMgrName.getStr(), Application::GetSettings().GetUILanguageTag() ); if( pResMgr ) { diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 89d43c2fa916..c94ea3a2cce6 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -151,8 +151,7 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l RegisterDisplay(&aWndFunc); if( ! pMgr ) { - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - pFreeMgr = pMgr = ResMgr::CreateResMgr("ofa", aLocale ); + pFreeMgr = pMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() ); } } @@ -278,8 +277,7 @@ sal_Bool SfxErrorHandler::GetClassString(sal_uLong lClassId, String &rStr) const { sal_Bool bRet = sal_False; - com::sun::star::lang::Locale aLocale( Application::GetSettings().GetUILanguageTag().getLocale() ); - ResMgr* pResMgr = ResMgr::CreateResMgr("ofa", aLocale ); + ResMgr* pResMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() ); if( pResMgr ) { ResId aId(RID_ERRHDL, *pResMgr ); @@ -407,8 +405,7 @@ sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, OUString &rStr) ResMgr* pFreeMgr = NULL; if( ! pMgr ) { - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - pFreeMgr = pMgr = ResMgr::CreateResMgr("ofa", aLocale ); + pFreeMgr = pMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() ); } if( pMgr ) { diff --git a/svtools/source/misc/svtresid.cxx b/svtools/source/misc/svtresid.cxx index 33ca09fe1095..5efc4474a4e6 100644 --- a/svtools/source/misc/svtresid.cxx +++ b/svtools/source/misc/svtresid.cxx @@ -25,7 +25,7 @@ static ResMgr* pMgr=NULL; namespace { - ResMgr* getResMgr(const ::com::sun::star::lang::Locale aLocale) + ResMgr* getResMgr(const LanguageTag& aLocale) { if (!pMgr) pMgr = ResMgr::CreateResMgr("svt", aLocale ); @@ -34,7 +34,7 @@ namespace ResMgr* getResMgr() { - return getResMgr(Application::GetSettings().GetUILanguageTag().getLocale()); + return getResMgr(Application::GetSettings().GetUILanguageTag()); } } diff --git a/svx/source/dialog/dialmgr.cxx b/svx/source/dialog/dialmgr.cxx index a171a9b2f691..ad4b33fca5de 100644 --- a/svx/source/dialog/dialmgr.cxx +++ b/svx/source/dialog/dialmgr.cxx @@ -32,7 +32,7 @@ static ResMgr* pResMgr=0; ResMgr* DialogsResMgr::GetResMgr() { if ( !pResMgr ) - pResMgr = ResMgr::CreateResMgr( "svx", Application::GetSettings().GetUILanguageTag().getLocale() ); + pResMgr = ResMgr::CreateResMgr( "svx", Application::GetSettings().GetUILanguageTag() ); return pResMgr; } diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 1f104056df5f..4a09e4b18122 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -788,7 +788,7 @@ namespace svxform // create a resource manager, for the svx resource file // and the UI locale ResMgr* pResMgr = ResMgr::CreateResMgr( - "svx", Application::GetSettings().GetUILanguageTag().getLocale() ); + "svx", Application::GetSettings().GetUILanguageTag() ); // load the resources for the AddSubmission modal dialog. // This will create our own resource context. diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 9e3094fba9dd..fc6834fa3673 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -65,7 +65,7 @@ ResMgr* GetGalleryResMgr() if( !pGalleryResMgr ) { pGalleryResMgr = ResMgr::CreateResMgr( - "gal", Application::GetSettings().GetUILanguageTag().getLocale() ); + "gal", Application::GetSettings().GetUILanguageTag() ); } return pGalleryResMgr; diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 686c41f8e09e..4fdc2bc3aeb4 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -198,7 +198,7 @@ const String SgaObject::GetTitle() const { rtl::OString aMgrName(rtl::OUStringToOString(aResourceName, RTL_TEXTENCODING_UTF8)); ResMgr* pResMgr = ResMgr::CreateResMgr( aMgrName.getStr(), - Application::GetSettings().GetUILanguageTag().getLocale() ); + Application::GetSettings().GetUILanguageTag() ); if ( pResMgr ) { ResId aResId( (sal_uInt16)nResId, *pResMgr ); diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 9fd5624086ec..01358ec6007f 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -436,7 +436,7 @@ ResMgr* ImpGetResMgr() if(!rGlobalData.pResMgr) { rGlobalData.pResMgr = - ResMgr::CreateResMgr( "svx", Application::GetSettings().GetUILanguageTag().getLocale() ); + ResMgr::CreateResMgr( "svx", Application::GetSettings().GetUILanguageTag() ); } return rGlobalData.pResMgr; diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index f6fd67bd3344..3a6e1eb23956 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -71,11 +71,10 @@ void test::BootstrapFixture::setUp() // force locale (and resource files loaded) to en-US - lang::Locale aLocale( "en", "US", ""); - ResMgr::SetDefaultLocale( aLocale ); + OUString aLangISO( "en-US" ); + ResMgr::SetDefaultLocale( LanguageTag( aLangISO) ); SvtSysLocaleOptions aLocalOptions; - OUString aLangISO( "en-US" ); aLocalOptions.SetLocaleConfigString( aLangISO ); aLocalOptions.SetUILocaleConfigString( aLangISO ); diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx index ae197370a355..376cc51c501a 100644 --- a/toolkit/source/helper/tkresmgr.cxx +++ b/toolkit/source/helper/tkresmgr.cxx @@ -55,9 +55,7 @@ void TkResMgr::ensureImplExists() if (m_pSimpleResMgr) return; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - - m_pSimpleResMgr = SimpleResMgr::Create( "tk", aLocale ); + m_pSimpleResMgr = SimpleResMgr::Create( "tk", Application::GetSettings().GetUILanguageTag() ); m_pResMgr = ResMgr::CreateResMgr( "tk" ); if (m_pSimpleResMgr) diff --git a/tools/inc/tools/resmgr.hxx b/tools/inc/tools/resmgr.hxx index 37aac4be9b6a..10bbfdc8734c 100644 --- a/tools/inc/tools/resmgr.hxx +++ b/tools/inc/tools/resmgr.hxx @@ -20,10 +20,9 @@ #define _TOOLS_RESMGR_HXX #include "tools/toolsdllapi.h" -#include <i18npool/lang.h> +#include <i18npool/languagetag.hxx> #include <tools/string.hxx> #include <tools/resid.hxx> -#include <com/sun/star/lang/Locale.hpp> #include <vector> @@ -136,11 +135,9 @@ public: /// Language-dependent resource library static const sal_Char* GetLang( LanguageType& eLanguage, sal_uInt16 nPrio = 0 ); ///< @deprecated see "tools/source/rc/resmgr.cxx" static ResMgr* SearchCreateResMgr( const sal_Char* pPrefixName, - com::sun::star::lang::Locale& rLocale ); + LanguageTag& rLocale ); static ResMgr* CreateResMgr( const sal_Char* pPrefixName, - com::sun::star::lang::Locale aLocale = com::sun::star::lang::Locale( rtl::OUString(), - rtl::OUString(), - rtl::OUString())); + LanguageTag aLocale = LanguageTag( LANGUAGE_SYSTEM) ); /// Test whether resource still exists void TestStack( const Resource * ); @@ -198,7 +195,7 @@ public: static void SetReadStringHook( ResHookProc pProc ); static ResHookProc GetReadStringHook(); - static void SetDefaultLocale( const com::sun::star::lang::Locale& rLocale ); + static void SetDefaultLocale( const LanguageTag& rLocale ); }; inline sal_uInt32 RSHEADER_TYPE::GetId() diff --git a/tools/inc/tools/simplerm.hxx b/tools/inc/tools/simplerm.hxx index 9c054ec7dc10..6176ad5783f3 100644 --- a/tools/inc/tools/simplerm.hxx +++ b/tools/inc/tools/simplerm.hxx @@ -25,9 +25,8 @@ #include <osl/mutex.hxx> #include <tools/resid.hxx> -#include <i18npool/lang.h> +#include <i18npool/languagetag.hxx> #include <tools/string.hxx> -#include <com/sun/star/lang/Locale.hpp> #include "tools/toolsdllapi.h" class InternalResMgr; @@ -45,17 +44,15 @@ public: in ThreadTextEncoding @param rLocale denotes the locale of the resource file to - load. If empty, a default locale will be used. + load. If empty (SYSTEM), a default locale will be used. */ SimpleResMgr( const sal_Char* pPrefixName, - const ::com::sun::star::lang::Locale& _rLocale); + const LanguageTag& rLocale); virtual ~SimpleResMgr(); static SimpleResMgr* Create( const sal_Char* pPrefixName, - ::com::sun::star::lang::Locale aLocale = ::com::sun::star::lang::Locale( rtl::OUString(), - rtl::OUString(), - rtl::OUString()));// only in VCL + LanguageTag aLocale = LanguageTag( LANGUAGE_SYSTEM) );// only in VCL bool IsValid() const { return m_pResImpl != NULL; } diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 7ef652381cf5..42b9580ef72f 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -90,13 +90,13 @@ class InternalResMgr OUString aPrefix; OUString aResName; bool bSingular; - com::sun::star::lang::Locale aLocale; + LanguageTag aLocale; boost::unordered_map<sal_uInt64, int>* pResUseDump; InternalResMgr( const OUString& rFileURL, const OUString& aPrefix, const OUString& aResName, - const com::sun::star::lang::Locale& rLocale ); + const LanguageTag& rLocale ); ~InternalResMgr(); sal_Bool Create(); @@ -126,9 +126,9 @@ class ResMgrContainer }; boost::unordered_map< OUString, ContainerElement, OUStringHash> m_aResFiles; - com::sun::star::lang::Locale m_aDefLocale; + LanguageTag m_aDefLocale; - ResMgrContainer() { init(); } + ResMgrContainer() : m_aDefLocale( LANGUAGE_SYSTEM) { init(); } ~ResMgrContainer(); void init(); @@ -138,16 +138,16 @@ public: static void release(); InternalResMgr* getResMgr( const OUString& rPrefix, - com::sun::star::lang::Locale& rLocale, + LanguageTag& rLocale, bool bForceNewInstance = false ); InternalResMgr* getNextFallback( InternalResMgr* pResMgr ); void freeResMgr( InternalResMgr* pResMgr ); - void setDefLocale( const com::sun::star::lang::Locale& rLocale ) + void setDefLocale( const LanguageTag& rLocale ) { m_aDefLocale = rLocale; } - const com::sun::star::lang::Locale& getDefLocale() const + const LanguageTag& getDefLocale() const { return m_aDefLocale; } }; @@ -216,52 +216,33 @@ void ResMgrContainer::init() // set default language LanguageType nLang = MsLangId::getSystemUILanguage(); - m_aDefLocale = LanguageTag( nLang).getLocale(); + m_aDefLocale.reset( nLang); } namespace { - bool isAlreadyPureenUS(const com::sun::star::lang::Locale &rLocale) + bool isAlreadyPureenUS(const LanguageTag &rLocale) { - return ( rLocale.Language == "en" && rLocale.Country == "US" && rLocale.Variant.isEmpty() ); + return ( rLocale.getLanguageType() == LANGUAGE_ENGLISH_US ); } } InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, - com::sun::star::lang::Locale& rLocale, + LanguageTag& rLocale, bool bForceNewInstance ) { - com::sun::star::lang::Locale aLocale( rLocale ); - OUStringBuffer aSearch( rPrefix.getLength() + 16 ); + LanguageTag aLocale( rLocale ); boost::unordered_map< OUString, ContainerElement, OUStringHash >::iterator it = m_aResFiles.end(); - /* FIXME-BCP47: handle language tags! */ - int nTries = 0; - if( !aLocale.Language.isEmpty() ) - nTries = 1; - if( !aLocale.Country.isEmpty() ) - nTries = 2; - if( !aLocale.Variant.isEmpty() ) - nTries = 3; - while( nTries-- ) + ::std::vector< OUString > aFallbacks( aLocale.getFallbackStrings()); + if (!isAlreadyPureenUS( aLocale)) + aFallbacks.push_back( "en-US"); // last resort if all fallbacks fail + + for (::std::vector< OUString >::const_iterator fb( aFallbacks.begin()); fb != aFallbacks.end(); ++fb) { - aSearch.append( rPrefix ); - if( nTries > -1 ) - { - aSearch.append( aLocale.Language ); - } - if( nTries > 0 ) - { - aSearch.append( sal_Unicode('-') ); - aSearch.append( aLocale.Country ); - } - if( nTries > 1 ) - { - aSearch.append( sal_Unicode('-') ); - aSearch.append( aLocale.Variant ); - } - it = m_aResFiles.find( aSearch.makeStringAndClear() ); + OUString aSearch( rPrefix + *fb ); + it = m_aResFiles.find( aSearch ); if( it != m_aResFiles.end() ) { // ensure InternalResMgr existance @@ -278,20 +259,11 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, } break; } - if( nTries == 0 && !isAlreadyPureenUS(aLocale) ) - { - // locale fallback failed - // fallback to en-US locale - nTries = 2; - aLocale.Language = "en"; - aLocale.Country = "US"; - aLocale.Variant = ""; - } } // try if there is anything with this prefix at all if( it == m_aResFiles.end() ) { - aLocale = com::sun::star::lang::Locale(); + aLocale.reset( LANGUAGE_SYSTEM); it = m_aResFiles.find( rPrefix ); if( it == m_aResFiles.end() ) { @@ -316,11 +288,13 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, } // try to guess locale sal_Int32 nIndex = rPrefix.getLength(); - aLocale.Language = it->first.getToken( 0, '-', nIndex ); - if( nIndex > 0 ) - aLocale.Country = it->first.getToken( 0, '-', nIndex ); - if( nIndex > 0 ) - aLocale.Variant = it->first.getToken( 0, '-', nIndex ); + if (nIndex < it->first.getLength()) + aLocale.reset( it->first.copy( nIndex)); + else + { + SAL_WARN( "tools.rc", "ResMgrContainer::getResMgr: it->first " << + it->first << " shorter than prefix " << rPrefix); + } break; } } @@ -329,20 +303,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, // give up if( it == m_aResFiles.end() ) { - /* FIXME-BCP47: handle language tags! */ - OUStringBuffer sKey = rPrefix; - sKey.append( rLocale.Language ); - if( !rLocale.Country.isEmpty() ) - { - sKey.append( sal_Unicode('-') ); - sKey.append( rLocale.Country ); - } - if( !rLocale.Variant.isEmpty() ) - { - sKey.append( sal_Unicode('-') ); - sKey.append( rLocale.Variant ); - } // if( !aLocale.Variant.isEmpty() ) - OUString sURL = sKey.makeStringAndClear() + ".res"; + OUString sURL = rPrefix + rLocale.getBcp47() + ".res"; if ( m_aResFiles.find(sURL) == m_aResFiles.end() ) { m_aResFiles[ sURL ].aFileURL = sURL; @@ -390,17 +351,18 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, InternalResMgr* ResMgrContainer::getNextFallback( InternalResMgr* pMgr ) { - /* FIXME-BCP47: handle language tags! */ - com::sun::star::lang::Locale aLocale = pMgr->aLocale; - if( !aLocale.Variant.isEmpty() ) - aLocale.Variant = OUString(); - else if( !aLocale.Country.isEmpty() ) - aLocale.Country = OUString(); - else if( !isAlreadyPureenUS(aLocale) ) - { - aLocale.Language = "en"; - aLocale.Country = "US"; - } + /* TODO-BCP47: this is nasty, but the previous code simply stripped a + * locale's variant and country in subsequent calls to end up with language + * only and then fallback to en-US if all failed, so this is at least + * equivalent if not better. Maybe this method could be changed to get + * passed / remember a fallback list and an index within to pick the next. + * */ + + ::std::vector< OUString > aFallbacks( pMgr->aLocale.getFallbackStrings()); + // The first is the locale itself, use next fallback or en-US. + /* TODO: what happens if the chain is "en-US", "en" -> "en-US", ... + * This was already an issue with the previous code. */ + LanguageTag aLocale( ((aFallbacks.size() > 1) ? aFallbacks[1] : OUString( "en-US"))); InternalResMgr* pNext = getResMgr( pMgr->aPrefix, aLocale, pMgr->bSingular ); // prevent recursion if( pNext == pMgr || ( pNext && pNext->aResName.equals( pMgr->aResName ) ) ) @@ -459,7 +421,7 @@ static ResHookProc pImplResHookProc = 0; InternalResMgr::InternalResMgr( const OUString& rFileURL, const OUString& rPrefix, const OUString& rResName, - const com::sun::star::lang::Locale& rLocale ) + const LanguageTag& rLocale ) : pContent( NULL ) , pStringBlock( NULL ) , pStm( NULL ) @@ -1322,11 +1284,7 @@ ResMgr* ResMgr::CreateFallbackResMgr( const ResId& rId, const Resource* pResourc // check that the fallback locale is not already in the chain of // fallbacks - prevent fallback loops ResMgr* pResMgr = this; - while( pResMgr && - ( pResMgr->pImpRes->aLocale.Language != pRes->aLocale.Language || - pResMgr->pImpRes->aLocale.Country != pRes->aLocale.Country || - pResMgr->pImpRes->aLocale.Variant != pRes->aLocale.Variant ) - ) + while( pResMgr && (pResMgr->pImpRes->aLocale != pRes->aLocale)) { pResMgr = pResMgr->pOriginalResMgr; } @@ -1556,14 +1514,13 @@ const char* ResMgr::GetLang( LanguageType& nType, sal_uInt16 nPrio ) } ResMgr* ResMgr::CreateResMgr( const sal_Char* pPrefixName, - com::sun::star::lang::Locale aLocale ) + LanguageTag aLocale ) { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); OUString aPrefix( pPrefixName, strlen( pPrefixName ), osl_getThreadTextEncoding() ); - /* FIXME-BCP47: handle language tags! */ - if( aLocale.Language.isEmpty() ) + if( aLocale.isSystemLocale() ) aLocale = ResMgrContainer::get().getDefLocale(); InternalResMgr* pImp = ResMgrContainer::get().getResMgr( aPrefix, aLocale ); @@ -1572,14 +1529,13 @@ ResMgr* ResMgr::CreateResMgr( const sal_Char* pPrefixName, ResMgr* ResMgr::SearchCreateResMgr( const sal_Char* pPrefixName, - com::sun::star::lang::Locale& rLocale ) + LanguageTag& rLocale ) { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); OUString aPrefix( pPrefixName, strlen( pPrefixName ), osl_getThreadTextEncoding() ); - /* FIXME-BCP47: handle language tags! */ - if( rLocale.Language.isEmpty() ) + if( rLocale.isSystemLocale() ) rLocale = ResMgrContainer::get().getDefLocale(); InternalResMgr* pImp = ResMgrContainer::get().getResMgr( aPrefix, rLocale ); @@ -1770,7 +1726,7 @@ ResHookProc ResMgr::GetReadStringHook() return pImplResHookProc; } -void ResMgr::SetDefaultLocale( const com::sun::star::lang::Locale& rLocale ) +void ResMgr::SetDefaultLocale( const LanguageTag& rLocale ) { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); ResMgrContainer::get().setDefLocale( rLocale ); @@ -1782,14 +1738,13 @@ const OUString& ResMgr::GetFileName() const } SimpleResMgr::SimpleResMgr( const sal_Char* pPrefixName, - const ::com::sun::star::lang::Locale& rLocale ) + const LanguageTag& rLocale ) { OUString aPrefix( pPrefixName, strlen( pPrefixName ), osl_getThreadTextEncoding() ); - com::sun::star::lang::Locale aLocale( rLocale ); + LanguageTag aLocale( rLocale ); osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); - /* FIXME-BCP47: handle language tags! */ - if( aLocale.Language.isEmpty() ) + if( aLocale.isSystemLocale() ) aLocale = ResMgrContainer::get().getDefLocale(); m_pResImpl = ResMgrContainer::get().getResMgr( aPrefix, aLocale, true ); @@ -1801,7 +1756,7 @@ SimpleResMgr::~SimpleResMgr() delete m_pResImpl; } -SimpleResMgr* SimpleResMgr::Create( const sal_Char* pPrefixName, com::sun::star::lang::Locale aLocale ) +SimpleResMgr* SimpleResMgr::Create( const sal_Char* pPrefixName, LanguageTag aLocale ) { return new SimpleResMgr( pPrefixName, aLocale ); } @@ -1845,9 +1800,7 @@ rtl::OUString SimpleResMgr::ReadString( sal_uInt32 nId ) if( pFallback ) { // handle possible recursion - if( pFallback->aLocale.Language != m_pResImpl->aLocale.Language || - pFallback->aLocale.Country != m_pResImpl->aLocale.Country || - pFallback->aLocale.Variant != m_pResImpl->aLocale.Variant ) + if( pFallback->aLocale != m_pResImpl->aLocale ) { pResHeader = (RSHEADER_TYPE*)pFallback->LoadGlobalRes( RSC_STRING, nId, &pResHandle ); } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 14b33eab496a..d7f3081ab48c 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -616,7 +616,7 @@ void Application::SetSettings( const AllSettings& rSettings ) { GetSettings(); *pSVData->maAppData.mpSettings = rSettings; - ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag().getLocale() ); + ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag() ); } else { @@ -627,7 +627,7 @@ void Application::SetSettings( const AllSettings& rSettings ) delete pSVData->mpResMgr; pSVData->mpResMgr = NULL; } - ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag().getLocale() ); + ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag() ); *pSVData->maAppData.mpSettings = rSettings; sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings ); if ( nChangeFlags ) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 95405290238b..f919af686e6d 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -175,7 +175,7 @@ ResMgr* ImplGetResMgr() ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->mpResMgr ) { - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); + LanguageTag aLocale( Application::GetSettings().GetUILanguageTag()); pSVData->mpResMgr = ResMgr::SearchCreateResMgr( VCL_CREATERESMGR_NAME( vcl ), aLocale ); static bool bMessageOnce = false; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 2070b764c0c2..f031b550c159 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -825,7 +825,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r { Graphic aGraphic; - ResMgr* pResMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag().getLocale() ); + ResMgr* pResMgr = ResMgr::CreateResMgr( "svt", Application::GetSettings().GetUILanguageTag() ); sal_Int32 nLogicalWidth = rConfigItem.ReadInt32( "LogicalWidth", 0 ); sal_Int32 nLogicalHeight = rConfigItem.ReadInt32( "LogicalHeight", 0 ); diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index 3515c8b10268..a19beac6b8f6 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -83,7 +83,7 @@ int RTFTokenizer::resolveParse() if (m_xStatusIndicator.is()) { - static ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag().getLocale()); + static ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag()); OUString sDocLoad(ResId(RID_SVXSTR_DOC_LOAD, *pResMgr).toString()); sal_uInt32 nCurrentPos = Strm().Tell(); diff --git a/xmlsecurity/Library_xmlsecurity.mk b/xmlsecurity/Library_xmlsecurity.mk index 45f7f7d54d09..bd0099681117 100644 --- a/xmlsecurity/Library_xmlsecurity.mk +++ b/xmlsecurity/Library_xmlsecurity.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Library_use_libraries,xmlsecurity,\ utl \ vcl \ xo \ + i18nisolang1 \ $(gb_UWINAPI) \ )) |