[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/sfx2 include/svl sfx2/source svl/source
Jan Holesovsky
kendy at collabora.com
Thu Jan 4 10:25:20 UTC 2018
include/sfx2/viewsh.hxx | 2 +-
include/svl/languageoptions.hxx | 2 +-
sfx2/source/view/viewsh.cxx | 7 +++++++
svl/source/config/languageoptions.cxx | 8 ++++++--
4 files changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 7ba33578d683031f50ad901361a69cb4f5aee50f
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/47334
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 023a37c98620..87f975352853 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -352,7 +352,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/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
index f223904a2f6e..c1c4db608b22 100644
--- a/include/svl/languageoptions.hxx
+++ b/include/svl/languageoptions.hxx
@@ -133,7 +133,7 @@ public:
};
OUString SVL_DLLPUBLIC getInstalledLocaleForLanguage(css::uno::Sequence<OUString> const & installed, OUString const & locale);
-OUString SVL_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence<OUString> const & installed);
+OUString SVL_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence<OUString> const & installed, const OUString& rPreferredLocale = OUString());
#endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 7d0a7d048b0e..4b50b2d8cafc 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -58,6 +58,7 @@
#include <vcl/commandinfoprovider.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <officecfg/Setup.hxx>
#include <sfx2/app.hxx>
#include "view.hrc"
#include <sfx2/viewsh.hxx>
@@ -1543,6 +1544,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, rBcp47LanguageTag), true).makeFallback();
+}
+
void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const
{
}
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx
index 8757244437f7..9fb7a0f1a3c1 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -286,9 +286,13 @@ OUString getInstalledLocaleForLanguage(css::uno::Sequence<OUString> const & inst
return OUString();
}
-OUString getInstalledLocaleForSystemUILanguage(const css::uno::Sequence<OUString>& rLocaleElementNames)
+OUString getInstalledLocaleForSystemUILanguage(const css::uno::Sequence<OUString>& rLocaleElementNames, const OUString& rPreferredLocale)
{
- OUString locale = getInstalledLocaleForLanguage(rLocaleElementNames, officecfg::System::L10N::UILocale::get());
+ OUString aPreferredLocale(rPreferredLocale);
+ if (aPreferredLocale.isEmpty())
+ aPreferredLocale = officecfg::System::L10N::UILocale::get();
+
+ OUString locale = getInstalledLocaleForLanguage(rLocaleElementNames, aPreferredLocale);
if (locale.isEmpty())
locale = getInstalledLocaleForLanguage(rLocaleElementNames, "en-US");
if (locale.isEmpty() && rLocaleElementNames.hasElements())
More information about the Libreoffice-commits
mailing list