[Libreoffice-commits] core.git: sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 13 15:20:21 UTC 2018


 sfx2/source/view/viewsh.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit e07f85a68cedde82a32a2b1f9bde75f25d7dc640
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 Dec 13 16:19:53 2018 +0100

    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'.
    
    Do it only when comphelper::LibreOfficeKit::isActive() to avoid
    modifying behaviour in the "normal" cases.
    
    Change-Id: Ib5bdfe07fd53251b42122389cb81782ef87b65c5
    Reviewed-on: https://gerrit.libreoffice.org/63446
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 683d6a45f288..246d5ea0c1ab 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.
  *
@@ -1495,8 +1495,17 @@ vcl::Window* SfxViewShell::GetEditWindowForActiveOLEObj() const
 
 void SfxViewShell::SetLOKLanguageTag(const OUString& rBcp47LanguageTag)
 {
+    LanguageTag aTag = LanguageTag(rBcp47LanguageTag, true);
+
     css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
-    maLOKLanguageTag = LanguageTag(getInstalledLocaleForSystemUILanguage(inst, /* bRequestInstallIfMissing */ false, rBcp47LanguageTag), true).makeFallback();
+    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 (comphelper::LibreOfficeKit::isActive() && aTag.getLanguage() == aFallbackTag.getLanguage())
+        maLOKLanguageTag = aTag;
+    else
+        maLOKLanguageTag = aFallbackTag;
 }
 
 void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const


More information about the Libreoffice-commits mailing list