summaryrefslogtreecommitdiff
path: root/svl/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-06-07 14:26:42 +0200
committerLászló Németh <nemeth@numbertext.org>2018-06-13 19:49:47 +0200
commit958c23246a3606f2cb33ad5c136127f951bbbc69 (patch)
tree425bfaa265d3e7700ffa22703b1a12b15cc94e85 /svl/qa
parentcc46e7b9c75ddbcaaefde5f396ba76b0b866fa58 (diff)
tdf#115007 NatNum12 "spell out" formats in dates
to support variants of preposition, suffixation, article or their combination. For example, Catalan "de març"/"d'abril", English "1st of May"/"First of May" or Hungarian "május 1-je/május 2-a". When the date format contains more than a date keyword, it needs to specify in NatNum12 argument which date element needs special formatting by using libnumbertext: '[NatNum12 ordinal-number]D' -> "1st" '[NatNum12 D=ordinal-number]D" of "MMMM' -> "1st of April" '[NatNum12 D=ordinal]D" of "MMMM' -> "first of April" '[NatNum12 YYYY=year,D=ordinal]D" of "MMMM", "YYYY' -> "first of April, nineteen ninety" Note: set only for YYYY, MMMM, M, DDDD, D and NNN/AAAA in date formats. It's possible to extend this for other keywords and date + time combinations, as required. Note 2: default l10n date formats can use the new NatNum12 date formats, see FormatElement in i18npool/source/localedata/ XML files and FormatElement specification: https://opengrok.libreoffice.org/xref/core/i18npool/source/localedata/data/locale.dtd#223 Change-Id: I598849f1492f4012e83cef9293773badbff16206 Reviewed-on: https://gerrit.libreoffice.org/55613 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'svl/qa')
-rw-r--r--svl/qa/unit/svl.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 45bff9ef2ca1..26b2f6a41588 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1394,6 +1394,15 @@ void Test::testUserDefinedNumberFormats()
sCode = "[NatNum12 ordinal-number]0";
sExpected = "123rd";
checkPreviewString(aFormatter, sCode, 123, eLang, sExpected);
+ sCode = "[NatNum12 D=ordinal-number]D\" of \"MMMM";
+ sExpected = "2nd of January";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+ sCode = "[NatNum12 D=ordinal-number,YYYY=year]D\" of \"MMMM\", \"YYYY";
+ sExpected = "2nd of January, nineteen hundred";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+ sCode = "[NatNum12 YYYY=year, D=ordinal]D\" of \"MMMM\", \"YYYY";
+ sExpected = "second of January, nineteen hundred";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
#endif
}
{ // tdf#105968 engineering format with value rounded up to next magnitude