diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-11-16 00:46:51 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-11-16 12:24:46 +0200 |
commit | 255c9d1b60280a28e855be837ec23dbd3673b9f1 (patch) | |
tree | c1c556cba9129e5d3c398f2ee28ccdd6f14b4a80 /sfx2 | |
parent | 117c88629df9fd922927f5aab1a1076183b9ddc9 (diff) |
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
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 65213c459ed6..c9b91d8ca9e0 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. * @@ -1506,8 +1506,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, 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, rBcp47LanguageTag), true).makeFallback(); +#endif } void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const |