From 5043cf9b5a4bfa93e1a88f81b931a13b7931bfd5 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 5 Oct 2018 13:54:31 +0200 Subject: Resolves: tdf#114927 recognize both Januar and Jänner in de-* German locales MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifcf087a8a20a1cdc460bd2caf6d1ceb528792e0d Reviewed-on: https://gerrit.libreoffice.org/61415 Reviewed-by: Eike Rathke Tested-by: Jenkins --- svl/source/numbers/zforfind.cxx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index a4980e6eb3ee..590cc0aabb54 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -649,6 +649,46 @@ short ImpSvNumberInputScan::GetMonth( const OUString& rString, sal_Int32& nPos ) break; // for } } + if (!res) + { + // Brutal hack for German locales that know "Januar" or "Jänner". + /* TODO: add alternative month names to locale data? if there are + * more languages.. */ + const LanguageTag& rLanguageTag = pFormatter->GetLanguageTag(); + if (rLanguageTag.getLanguage() == "de") + { + if (rLanguageTag.getCountry() == "AT") + { + // Locale data has Jänner/Jän + assert(pUpperMonthText[0] == u"J\u00C4NNER"); + if (StringContainsWord( "JANUAR", rString, nPos)) + { + nPos += 6; + res = 1; + } + else if (StringContainsWord( "JAN", rString, nPos)) + { + nPos += 3; + res = -1; + } + } + else + { + // Locale data has Januar/Jan + assert(pUpperMonthText[0] == "JANUAR"); + if (StringContainsWord( u"J\u00C4NNER", rString, nPos)) + { + nPos += 6; + res = 1; + } + else if (StringContainsWord( u"J\u00C4N", rString, nPos)) + { + nPos += 3; + res = -1; + } + } + } + } } return res; -- cgit