[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sfx2/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 19 16:31:41 UTC 2019
sfx2/source/view/viewsh.cxx | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
New commits:
commit ee0fcc88c9c56756f66e9456ac6d17f611103f8c
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Nov 16 00:46:51 2018 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Sep 19 18:30:42 2019 +0200
Be less eager to use a fallback in SfxViewShell::SetLOKLanguageTag()
If the fallback language tag based on available localisations would
have the same language as the original Bcp47 tag string, use a tag
based on the original.
For example, if the user locale is 'de-CH', the localisation for plain
'de' will be used automatically anyway, without making the LOK
language tag 'de' which would actually end up being stored as 'de-DE'
and thus be misleading.
We will need to know that it's the 'de-CH' locale we are actually
working with when handling Swiss German translations by replacing 'ß'
characters in a generic German translation with 'ss'.
In this branch, do this only for iOS.
Change-Id: I5636d89e715d4881463881e19d4e77af93a0ecaa
Reviewed-on: https://gerrit.libreoffice.org/79133
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Tested-by: Tor Lillqvist <tml at collabora.com>
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index e7e61f40ec83..42d85f336da8 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -1517,8 +1517,22 @@ vcl::Window* SfxViewShell::GetEditWindowForActiveOLEObj() const
void SfxViewShell::SetLOKLanguageTag(const OUString& rBcp47LanguageTag)
{
+#ifdef IOS
+ LanguageTag aTag = LanguageTag(rBcp47LanguageTag, true);
+
+ css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
+ LanguageTag aFallbackTag = LanguageTag(getInstalledLocaleForSystemUILanguage(inst, /* bRequestInstallIfMissing */ false, rBcp47LanguageTag), true).makeFallback();
+
+ // If we want de-CH, and the de localisation is available, we don't want to use de-DE as then
+ // the magic in Translate::get() won't turn ess-zet into double s. Possibly other similar cases?
+ if (aTag.getLanguage() == aFallbackTag.getLanguage())
+ maLOKLanguageTag = aTag;
+ else
+ maLOKLanguageTag = aFallbackTag;
+#else
css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
maLOKLanguageTag = LanguageTag(getInstalledLocaleForSystemUILanguage(inst, /* bRequestInstallIfMissing */ false, rBcp47LanguageTag), true).makeFallback();
+#endif
}
void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const
More information about the Libreoffice-commits
mailing list