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

Laurent BP laurent.balland-poirier at laposte.net
Mon Oct 23 11:43:33 UTC 2017


 svl/source/numbers/zforscan.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit b4da498db27bcf6e93c1899e9a19942b3462946b
Author: Laurent BP <laurent.balland-poirier at laposte.net>
Date:   Sat Oct 21 00:56:00 2017 +0200

    Follow-up of resolution of tdf#33689 for Finnish
    
    Using MM in Finnish should be minutes.
    However, if English NfKeywords are used, MM can be month or minutes.
    This patch try to distinguish minute/month if minute was first detected.
    
    Change-Id: I029f3f2a4d79cb4a9730f8c32147f14bedd8094c
    Reviewed-on: https://gerrit.libreoffice.org/43633
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index d4991fad3c57..cbb71aa47733 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1273,6 +1273,8 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
                 break;
             case NF_KEY_M:                          // M
             case NF_KEY_MM:                         // MM
+            case NF_KEY_MI:                         // M  minute detected in Finnish
+            case NF_KEY_MMI:                        // MM
                 /* Minute or month.
                    Minute if one of:
                    * preceded by time keyword H (ignoring separators)
@@ -1296,13 +1298,20 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
                     PreviousChar(i) == '['  )       // [M
                 {
                     eNewType = css::util::NumberFormat::TIME;
-                    nTypeArray[i] -= 2;             // 6 -> 4, 7 -> 5
+                    if ( nTypeArray[i] == NF_KEY_M || nTypeArray[i] == NF_KEY_MM )
+                    {
+                        nTypeArray[i] -= 2;             // 6 -> 4, 7 -> 5
+                    }
                     bIsTimeDetected = false;        // next M should be month
                     bHaveMinute = true;
                 }
                 else
                 {
                     eNewType = css::util::NumberFormat::DATE;
+                    if ( nTypeArray[i] == NF_KEY_MI || nTypeArray[i] == NF_KEY_MMI )
+                    {   // follow resolution of tdf#33689 for Finnish
+                        nTypeArray[i] += 2;             // 4 -> 6, 5 -> 7
+                    }
                 }
                 break;
             case NF_KEY_MMM:                        // MMM


More information about the Libreoffice-commits mailing list