diff options
author | Eike Rathke <erack@redhat.com> | 2018-10-05 13:54:31 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-10-05 16:36:23 +0200 |
commit | 5043cf9b5a4bfa93e1a88f81b931a13b7931bfd5 (patch) | |
tree | f3984742a5c0c8544b88ff0e03c67136c3a87e6b | |
parent | 05a337e297eb0cfe88c99503d760bd9eaf495b7d (diff) |
Resolves: tdf#114927 recognize both Januar and Jänner in de-* German locales
Change-Id: Ifcf087a8a20a1cdc460bd2caf6d1ceb528792e0d
Reviewed-on: https://gerrit.libreoffice.org/61415
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
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; |