Kaydet (Commit) 255c9d1b authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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
üst 117c8862
/* -*- 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment