[Libreoffice-commits] core.git: include/sfx2 include/svtools sfx2/source svtools/source
Jan Holesovsky
kendy at collabora.com
Fri Jan 5 08:52:29 UTC 2018
include/sfx2/viewsh.hxx | 2 +-
include/svtools/langhelp.hxx | 2 +-
sfx2/source/view/viewsh.cxx | 8 ++++++++
svtools/source/misc/langhelp.cxx | 7 +++++--
4 files changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 7ca3490d91a1fc4e01b34ea1a2f281968b0b1479
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Jan 3 17:49:25 2018 +0100
lokdialog: Use only one of the installed langpacks when setting locale.
Change-Id: I446775b121b7806a549f4dbbaa1f2dcf019d9bc2
Reviewed-on: https://gerrit.libreoffice.org/47386
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 0c83f5faee15..e7a0f6d7fec1 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -344,7 +344,7 @@ public:
virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
/// Set the LibreOfficeKit language of this view.
- void SetLOKLanguageTag(const OUString& rBcp47LanguageTag) { maLOKLanguageTag = LanguageTag(rBcp47LanguageTag, true); }
+ void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
/// Get the LibreOfficeKit language of this view.
const LanguageTag& GetLOKLanguageTag() const { return maLOKLanguageTag; }
};
diff --git a/include/svtools/langhelp.hxx b/include/svtools/langhelp.hxx
index db22bb368367..e3f914c7457e 100644
--- a/include/svtools/langhelp.hxx
+++ b/include/svtools/langhelp.hxx
@@ -23,7 +23,7 @@
SVT_DLLPUBLIC void localizeWebserviceURI( OUString& io_rURI );
OUString SVT_DLLPUBLIC getInstalledLocaleForLanguage(css::uno::Sequence<OUString> const & installed, OUString const & locale);
-OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence<OUString> const & installed, bool bRequestInstallIfMissing);
+OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence<OUString> const & installed, bool bRequestInstallIfMissing, const OUString& rPreferredLocale = OUString());
#endif
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 8060a330f132..7ebc86176495 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -26,6 +26,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/toolbox.hxx>
#include <svl/intitem.hxx>
+#include <svtools/langhelp.hxx>
#include <svtools/sfxecode.hxx>
#include <svtools/ehdl.hxx>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -57,6 +58,7 @@
#include <vcl/commandinfoprovider.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <officecfg/Setup.hxx>
#include <sfx2/app.hxx>
#include <sfx2/viewsh.hxx>
#include "viewimp.hxx"
@@ -1488,6 +1490,12 @@ vcl::Window* SfxViewShell::GetEditWindowForActiveOLEObj() const
return pEditWin;
}
+void SfxViewShell::SetLOKLanguageTag(const OUString& rBcp47LanguageTag)
+{
+ css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
+ maLOKLanguageTag = LanguageTag(getInstalledLocaleForSystemUILanguage(inst, /* bRequestInstallIfMissing */ false, rBcp47LanguageTag), true).makeFallback();
+}
+
void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const
{
}
diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx
index e4e64375e4b5..5bbc01172964 100644
--- a/svtools/source/misc/langhelp.cxx
+++ b/svtools/source/misc/langhelp.cxx
@@ -102,9 +102,12 @@ public:
}
};
-OUString getInstalledLocaleForSystemUILanguage(const css::uno::Sequence<OUString>& rLocaleElementNames, bool bRequestInstallIfMissing)
+OUString getInstalledLocaleForSystemUILanguage(const css::uno::Sequence<OUString>& rLocaleElementNames, bool bRequestInstallIfMissing, const OUString& rPreferredLocale)
{
- OUString wantedLocale = officecfg::System::L10N::UILocale::get();
+ OUString wantedLocale(rPreferredLocale);
+ if (wantedLocale.isEmpty())
+ wantedLocale = officecfg::System::L10N::UILocale::get();
+
OUString locale = getInstalledLocaleForLanguage(rLocaleElementNames, wantedLocale);
if (bRequestInstallIfMissing && locale.isEmpty() && !wantedLocale.isEmpty() && !Application::IsHeadlessModeEnabled() &&
officecfg::Office::Common::PackageKit::EnableLangpackInstallation::get())
More information about the Libreoffice-commits
mailing list