[Libreoffice-commits] core.git: svl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 5 14:36:50 UTC 2018


 svl/source/numbers/zforfind.cxx |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

New commits:
commit 5043cf9b5a4bfa93e1a88f81b931a13b7931bfd5
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Fri Oct 5 13:54:31 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Oct 5 16:36:23 2018 +0200

    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 at redhat.com>
    Tested-by: Jenkins

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;


More information about the Libreoffice-commits mailing list