sfx2/source/view/viewsh.cxx | 16 +++++++++++++++- unotools/source/i18n/resmgr.cxx | 10 +++++++++- 2 files changed, 24 insertions(+), 2 deletions(-)
New commits: commit 3729f11336c21a4273c18da9bf2891c69a9489be Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri Nov 16 00:54:14 2018 +0200 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Fri Nov 16 12:24:54 2018 +0200 Swiss Standard German: replace 'ß' in German translation with 'ss' In this branch, for iOS only. Change-Id: I2af12394648ddad352f24c71581be0f9bf5e3d70 diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx index 4159cc670f81..ad75a3ed612f 100644 --- a/unotools/source/i18n/resmgr.cxx +++ b/unotools/source/i18n/resmgr.cxx @@ -200,7 +200,15 @@ namespace Translate //otherwise translate it const std::string ret = boost::locale::pgettext(sContext.getStr(), pId, loc); - return ExpandVariables(createFromUtf8(ret.data(), ret.size())); + OUString result(ExpandVariables(createFromUtf8(ret.data(), ret.size()))); + +#ifdef IOS + // If it is de-CH, change sharp s to double s. + if (std::use_facet<boost::locale::info>(loc).country() == "CH" && + std::use_facet<boost::locale::info>(loc).language() == "de") + result = result.replaceAll(OUString::fromUtf8("\xC3\x9F"), "ss"); +#endif + return result; } static ResHookProc pImplResHookProc = nullptr; commit 255c9d1b60280a28e855be837ec23dbd3673b9f1 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri Nov 16 00:46:51 2018 +0200 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Fri Nov 16 12:24:46 2018 +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 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits