Kaydet (Commit) 101a79cc authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Michael Meeks

lokdialog: Allow switching language of some of the ResMgr's.

This way, it is possible to have all the strings translated in dialogs even
when different users use different languages.  [It was already possible
to have different languages previously, but not everything in the dialog has
switched - like the buttons at the bottom of the dialogs etc.]

Change-Id: I29a5ae6d31a370eec60397884200b684ec1bf5b9
Reviewed-on: https://gerrit.libreoffice.org/46417Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/46979Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst a5fe3117
......@@ -22,8 +22,7 @@
OUString AccResId(const char* pId)
{
static std::locale loc = Translate::Create("acc");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("acc"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -64,7 +64,6 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/framework/mediacontrol \
avmedia/source/framework/MediaControlBase \
avmedia/source/framework/mediaitem \
avmedia/source/framework/mediamisc \
avmedia/source/framework/mediaplayer \
avmedia/source/framework/mediatoolbox \
avmedia/source/framework/soundhandler \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <unotools/resmgr.hxx>
#include <mediamisc.hxx>
namespace avmedia {
const std::locale& GetResLocale()
{
static std::locale loc = Translate::Create("avmedia");
return loc;
}
} // namespace avmedia
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -41,14 +41,9 @@
// Mime types
#define AVMEDIA_MIMETYPE_COMMON "application/vnd.sun.star.media"
namespace avmedia
{
const std::locale& GetResLocale();
}
inline OUString AvmResId(const char* pId)
{
return Translate::get(pId, ::avmedia::GetResLocale());
return Translate::get(pId, Translate::Create("avmedia"));
}
#endif
......
......@@ -586,10 +586,9 @@ bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen )
}
}
const std::locale& BasResLocale()
std::locale BasResLocale()
{
static std::locale loc(Translate::Create("sb"));
return loc;
return Translate::Create("sb");
}
OUString BasResId(const char *pId)
......
......@@ -234,7 +234,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/tools/RelativePositionHelper \
chart2/source/tools/RelativeSizeHelper \
chart2/source/tools/ResId \
chart2/source/tools/ResourceManager \
chart2/source/tools/Scaling \
chart2/source/tools/SceneProperties \
chart2/source/tools/StatisticsHelper \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_CHART2_SOURCE_INC_RESOURCEMANAGER_HXX
#define INCLUDED_CHART2_SOURCE_INC_RESOURCEMANAGER_HXX
#include "charttoolsdllapi.hxx"
#include <locale>
namespace chart
{
namespace ResourceManager
{
const std::locale& getResourceLocale();
}
} // namespace chart
// INCLUDED_CHART2_SOURCE_INC_RESOURCEMANAGER_HXX
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -18,14 +18,13 @@
*/
#include <ResId.hxx>
#include <ResourceManager.hxx>
#include <unotools/resmgr.hxx>
namespace chart
{
OUString SchResId(const char *pId)
{
return Translate::get(pId, ResourceManager::getResourceLocale());
return Translate::get(pId, Translate::Create("chart"));
}
} // namespace chart
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <ResourceManager.hxx>
#include <unotools/resmgr.hxx>
namespace chart
{
const std::locale& ResourceManager::getResourceLocale()
{
static std::locale loc = Translate::Create("chart");
return loc;
}
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -22,8 +22,7 @@
OUString CuiResId(const char *pKey)
{
static std::locale loc(Translate::Create("cui"));
return Translate::get(pKey, loc);
return Translate::get(pKey, Translate::Create("cui"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -36,8 +36,7 @@ namespace dbaccess
OUString ResourceManager::loadString(const char* pResId)
{
static std::locale loc = Translate::Create("dba");
return Translate::get(pResId, loc);
return Translate::get(pResId, Translate::Create("dba"));
}
OUString ResourceManager::loadString(const char* pResId, const sal_Char* _pPlaceholderAscii, const OUString& _rReplace)
......
......@@ -195,7 +195,7 @@ uno::Reference< linguistic2::XLanguageGuessing > const & GlobalEditData::GetLang
OUString EditResId(const char *pId)
{
return Translate::get(pId, EditDLL::GetResLocale());
return Translate::get(pId, Translate::Create("editeng"));
}
EditDLL::EditDLL()
......@@ -207,12 +207,6 @@ EditDLL::~EditDLL()
{
}
std::locale& EditDLL::GetResLocale()
{
static std::locale loc = Translate::Create("editeng");
return loc;
}
editeng::SharedVclResources::SharedVclResources()
: m_pVirDev(VclPtr<VirtualDevice>::Create())
{
......
......@@ -37,8 +37,7 @@ namespace compmodule
OUString ModuleRes(const char* pId)
{
static std::locale loc = Translate::Create("pcr");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("pcr"));
}
//- registration helper
......
......@@ -55,8 +55,7 @@ namespace pcr
OUString PcrRes(const char* pId)
{
static std::locale loc = Translate::Create("pcr");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("pcr"));
}
} // namespace pcr
......
......@@ -321,8 +321,7 @@ namespace {
OUString SaneResId(const char *pID)
{
static std::locale loc = Translate::Create("pcr");
return Translate::get(pID, loc);
return Translate::get(pID, Translate::Create("pcr"));
}
}
......
......@@ -42,21 +42,14 @@
#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/security/XCertificate.hpp>
static std::locale& getPDFFilterResLocale()
{
static std::locale loc = Translate::Create("flt");
return loc;
}
OUString PDFFilterResId(const char* pId)
{
return Translate::get(pId, getPDFFilterResLocale());
return Translate::get(pId, Translate::Create("flt"));
}
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
/** Tabbed PDF dialog implementation
Please note: the default used here are the same as per specification,
They should be the same in PDFFilter::implExport and in PDFExport::PDFExport
......
......@@ -60,8 +60,7 @@ using ::rtl::Uri;
OUString XsltResId(const char* pId)
{
static std::locale loc = Translate::Create("flt");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("flt"));
}
XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent,
......
......@@ -26,8 +26,7 @@ namespace frm
{
OUString loadString(const char* pResId)
{
static std::locale loc = Translate::Create("frm");
return Translate::get(pResId, loc);
return Translate::get(pResId, Translate::Create("frm"));
}
}
}
......
......@@ -21,8 +21,7 @@
OUString ForResId(const char *pId)
{
static std::locale loc = Translate::Create("for");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("for"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -13,8 +13,7 @@
inline OUString FpsResId(const char* pId)
{
static std::locale loc = Translate::Create("fps");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("fps"));
};
#endif
......
......@@ -22,8 +22,7 @@
OUString FwkResId(const char* pId)
{
static std::locale loc(Translate::Create("fwk"));
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("fwk"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -69,7 +69,7 @@ enum class PropertyMode
};
BASIC_DLLPUBLIC const ErrMsgCode* getRID_BASIC_START();
BASIC_DLLPUBLIC const std::locale& BasResLocale();
BASIC_DLLPUBLIC std::locale BasResLocale();
BASIC_DLLPUBLIC OUString BasResId(const char* pId);
#endif
......
......@@ -41,7 +41,6 @@ public:
EditDLL();
~EditDLL();
static std::locale& GetResLocale();
GlobalEditData* GetGlobalData() const { return pGlobalData.get(); }
std::shared_ptr<editeng::SharedVclResources> GetSharedVclResources();
static EditDLL& Get();
......
......@@ -24,7 +24,7 @@
#include <rtl/ustring.hxx>
#include <locale>
SVT_DLLPUBLIC const std::locale& SvtResLocale();
SVT_DLLPUBLIC std::locale SvtResLocale();
SVT_DLLPUBLIC OUString SvtResId(const char* pId);
#endif // INCLUDED_SVTOOLS_SVTRESID_HXX
......
......@@ -22,7 +22,7 @@
#include <rtl/ustring.hxx>
#include <svx/svxdllapi.h>
SVX_DLLPUBLIC const std::locale& SvxResLocale();
SVX_DLLPUBLIC std::locale SvxResLocale();
SVX_DLLPUBLIC OUString SvxResId(const char* pId);
#endif
......
......@@ -30,8 +30,7 @@
OUString RptResId(const char* pId)
{
static std::locale loc = Translate::Create("rpt");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("rpt"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -46,8 +46,7 @@ using namespace com::sun::star;
OUString SolverComponent::GetResourceString(const char* pId)
{
static std::locale loc = Translate::Create("scc");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("scc"));
}
size_t ScSolverCellHash::operator()( const css::table::CellAddress& rAddress ) const
......
......@@ -283,8 +283,7 @@ OUString SwarmSolver::getResourceString(const char* pId)
if (!pId)
return sString;
static std::locale aLocale = Translate::Create("scc");
return Translate::get(pId, aLocale);
return Translate::get(pId, Translate::Create("scc"));
}
uno::Reference<table::XCell> SwarmSolver::getCell(const table::CellAddress& rPosition)
......
......@@ -17,14 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sfx2/sfxresid.hxx>
#include <unotools/resmgr.hxx>
OUString SfxResId(const char* pId)
{
static std::locale loc = Translate::Create("sfx");
return Translate::get(pId, loc);
return Translate::get(pId, Translate::Create("sfx"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -28,8 +28,7 @@
OUString SvlResId(const char* id)
{
static std::locale loc = Translate::Create("svl");
return Translate::get(id, loc);
return Translate::get(id, Translate::Create("svl"));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -20,10 +20,9 @@
#include <unotools/resmgr.hxx>
#include <svtools/svtresid.hxx>
const std::locale& SvtResLocale()
std::locale SvtResLocale()
{
static std::locale loc = Translate::Create("svt");
return loc;
return Translate::Create("svt");
}
OUString SvtResId(const char* pId)
......
......@@ -20,10 +20,9 @@
#include <unotools/resmgr.hxx>
#include <svx/dialmgr.hxx>
const std::locale& SvxResLocale()
std::locale SvxResLocale()
{
static std::locale loc = Translate::Create("svx");
return loc;
return Translate::Create("svx");
}
OUString SvxResId(const char* pId)
......
......@@ -2880,6 +2880,9 @@ const LanguageTag& AllSettings::GetLanguageTag() const
return aRet;
}
if (comphelper::LibreOfficeKit::isActive())
return comphelper::LibreOfficeKit::getLanguageTag();
// SYSTEM locale means: use settings from SvtSysLocale that is resolved
if ( mxData->maLocale.isSystemLocale() )
mxData->maLocale = mxData->maSysLocale.GetLanguageTag();
......@@ -2895,6 +2898,9 @@ const LanguageTag& AllSettings::GetUILanguageTag() const
return aRet;
}
if (comphelper::LibreOfficeKit::isActive())
return comphelper::LibreOfficeKit::getLanguageTag();
// the UILocale is never changed
if ( mxData->maUILocale.isSystemLocale() )
mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag();
......
......@@ -53,7 +53,6 @@ $(eval $(call gb_Library_add_exception_objects,writerperfect,\
writerperfect/source/common/DirectoryStream \
writerperfect/source/common/DocumentHandler \
writerperfect/source/common/WPFTEncodingDialog \
writerperfect/source/common/WPFTResMgr \
writerperfect/source/common/WPXSvInputStream \
))
......
......@@ -7,14 +7,9 @@
#include <unotools/resmgr.hxx>
struct WRITERPERFECT_DLLPUBLIC WPFTResLocale
{
static std::locale &GetResLocale();
};
inline OUString WpResId(const char *pId)
{
return Translate::get(pId, WPFTResLocale::GetResLocale());
return Translate::get(pId, Translate::Create("wpt"));
}
#endif
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <WPFTResMgr.hxx>
std::locale &WPFTResLocale::GetResLocale()
{
static std::locale loc(Translate::Create("wpt"));
return loc;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -34,8 +34,6 @@ class LocaleDataWrapper;
namespace XmlSec
{
const std::locale& GetResLocale();
const LocaleDataWrapper& GetLocaleData();
DateTime GetDateTime( const css::util::DateTime& _rDT );
OUString GetDateTimeString( const css::util::DateTime& _rDT );
......@@ -53,7 +51,7 @@ namespace XmlSec
inline OUString XsResId(const char* pId)
{
return Translate::get(pId, XmlSec::GetResLocale());
return Translate::get(pId, Translate::Create("xsc"));
}
#endif
......
......@@ -32,12 +32,6 @@ using namespace std;
namespace XmlSec
{
const std::locale& GetResLocale()
{
static const std::locale loc = Translate::Create("xsc");
return loc;
}
const LocaleDataWrapper& GetLocaleData()
{
static SvtSysLocale ourSysLocale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment