summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-12-13 19:17:48 +0100
committerMichael Meeks <michael.meeks@collabora.com>2017-12-14 11:31:50 +0100
commiteaccbef4f4f9509152efb7613f2ff48a2d6e7a5e (patch)
tree458e6f8eebde83eb7e9667a3091e5dd1305eb3b2 /vcl
parent689176e9424e617a64edd5e233b750b2269a7275 (diff)
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/46417 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/svdata.hxx2
-rw-r--r--vcl/source/app/settings.cxx6
-rw-r--r--vcl/source/app/svapp.cxx3
-rw-r--r--vcl/source/app/svdata.cxx8
-rw-r--r--vcl/source/app/svmain.cxx6
-rw-r--r--vcl/source/window/builder.cxx9
6 files changed, 16 insertions, 18 deletions
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 5ed1464787ac..0f44a3937f52 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -321,7 +321,7 @@ struct ImplSVData
SalTimer* mpSalTimer = nullptr; // interface to sal event loop/timers
SalI18NImeStatus* mpImeStatus = nullptr; // interface to ime status window
SalSystem* mpSalSystem = nullptr; // SalSystem interface
- ResMgr* mpResMgr = nullptr; // SV-Resource-Manager
+ std::unique_ptr<ResMgr> mpResMgr; // SV-Resource-Manager
sal_uInt64 mnTimerPeriod = 0; // current timer period
ImplSVAppData maAppData; // indepen data for class Application
ImplSVGDIData maGDIData; // indepen data for Output classes
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 94cc2a351493..dedc6bb84179 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2889,6 +2889,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();
@@ -2904,6 +2907,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();
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index b30f765a17af..e08adff710e3 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -699,8 +699,7 @@ void Application::SetSettings( const AllSettings& rSettings )
if( aOldSettings.GetUILanguageTag().getLanguageType() != rSettings.GetUILanguageTag().getLanguageType() &&
pSVData->mpResMgr )
{
- delete pSVData->mpResMgr;
- pSVData->mpResMgr = nullptr;
+ pSVData->mpResMgr.reset();
}
ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag() );
*pSVData->maAppData.mpSettings = rSettings;
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 81b70aada41a..5f38644c8a1d 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -162,10 +162,10 @@ vcl::Window *ImplGetDefaultContextWindow()
ResMgr* ImplGetResMgr()
{
ImplSVData* pSVData = ImplGetSVData();
- if ( !pSVData->mpResMgr )
+ LanguageTag aLocale(Application::GetSettings().GetUILanguageTag());
+ if (!pSVData->mpResMgr || pSVData->mpResMgr->GetLocale() != aLocale)
{
- LanguageTag aLocale( Application::GetSettings().GetUILanguageTag());
- pSVData->mpResMgr = ResMgr::SearchCreateResMgr( "vcl", aLocale );
+ pSVData->mpResMgr.reset(ResMgr::SearchCreateResMgr("vcl", aLocale));
static bool bMessageOnce = false;
if( !pSVData->mpResMgr && ! bMessageOnce )
@@ -179,7 +179,7 @@ ResMgr* ImplGetResMgr()
aBox->Execute();
}
}
- return pSVData->mpResMgr;
+ return pSVData->mpResMgr.get();
}
ResId VclResId( sal_Int32 nId )
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 2cd613727ab4..a74279686a43 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -565,11 +565,7 @@ void DeInitVCL()
delete pSVData->maGDIData.mpScreenFontCache;
pSVData->maGDIData.mpScreenFontCache = nullptr;
- if ( pSVData->mpResMgr )
- {
- delete pSVData->mpResMgr;
- pSVData->mpResMgr = nullptr;
- }
+ pSVData->mpResMgr.reset();
ResMgr::DestroyAllResMgr();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 1809b7a8d711..5202bbfd0b29 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -195,13 +195,10 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
OUString sUri = sUIDir + sUIFile;
- LanguageTag aLanguageTag = Application::GetSettings().GetUILanguageTag();
- if (comphelper::LibreOfficeKit::isActive())
- aLanguageTag = comphelper::LibreOfficeKit::getLanguageTag();
-
- bool bEN_US = (aLanguageTag.getBcp47() == "en-US");
+ const LanguageTag& rLanguageTag = Application::GetSettings().GetUILanguageTag();
+ bool bEN_US = (rLanguageTag.getBcp47() == "en-US");
if (!bEN_US)
- loadTranslations(aLanguageTag, sUri);
+ loadTranslations(rLanguageTag, sUri);
try
{