[Libreoffice-commits] core.git: writerfilter/source
Eike Rathke (via logerrit)
logerrit at kemper.freedesktop.org
Sat Aug 14 23:46:45 UTC 2021
writerfilter/source/dmapper/DomainMapper.cxx | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
New commits:
commit 23f17b7ea6fbd2f422c7e40192ae60e4df25224c
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Sat Aug 14 23:32:39 2021 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Sun Aug 15 01:46:08 2021 +0200
Resolves: tdf#137742 Workaround cheesy Google Docs writing language-only tags
Change-Id: I2dc85abb70d53769d2e36102070e30ed71e8d888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120495
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b74ee3d02daf..ac63dc699fd2 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -666,7 +666,29 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", sStringValue);
else if (nName == NS_ooxml::LN_CT_Language_bidi)
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "bidi", sStringValue);
- lang::Locale aLocale( LanguageTag::convertToLocale( sStringValue));
+ lang::Locale aLocale;
+ if (sStringValue.getLength() <= 3 && sStringValue.getLength() >= 1)
+ {
+ // Cheesy Google Docs is known to tag language-only even for
+ // "en" or others that need some region to distinguish language
+ // variants for spell-checker and hyphenation. Obtain our known
+ // fallback to clarify and match. The original value/context is
+ // unknown anyway.
+ LanguageTag aLanguageTag( sStringValue);
+ aLanguageTag.makeFallback();
+ if (aLanguageTag.getLanguage() == sStringValue)
+ aLocale = aLanguageTag.getLocale();
+ else
+ {
+ // Do not fallback for an unknown language, which usually
+ // results in "en-US", or any other non-matching case.
+ aLocale = LanguageTag::convertToLocale( sStringValue);
+ }
+ }
+ else
+ {
+ aLocale = LanguageTag::convertToLocale( sStringValue);
+ }
if (m_pImpl->GetTopContext())
m_pImpl->GetTopContext()->Insert(NS_ooxml::LN_CT_Language_val== nName ? PROP_CHAR_LOCALE :
NS_ooxml::LN_CT_Language_eastAsia == nName ? PROP_CHAR_LOCALE_ASIAN : PROP_CHAR_LOCALE_COMPLEX,
More information about the Libreoffice-commits
mailing list