From b4da498db27bcf6e93c1899e9a19942b3462946b Mon Sep 17 00:00:00 2001 From: Laurent BP Date: Sat, 21 Oct 2017 00:56:00 +0200 Subject: 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 Reviewed-by: Eike Rathke --- svl/source/numbers/zforscan.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3