summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-10-27 18:22:21 +0200
committerEike Rathke <erack@redhat.com>2017-10-27 18:29:46 +0200
commitf285f3134378cb9a31f02200991e3fc44ca79419 (patch)
tree5122505c34af62ef591dfbf840be2e61b1854ed8
parent940808a512ff637f161cc3eb1de0362b2f95318c (diff)
Parse/gen optional <DecimalSeparatorAlternative> in locale data, tdf#81671
Change-Id: I2781040c76e7c3dbfb4eedc7830a1f24b4c56b46
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 2c0134448343..25b87d8c03a3 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -227,7 +227,7 @@ OUString LocaleNode::writeParameterCheckLen( const OFileWriter &of,
OUString aVal;
if (pNode)
aVal = pNode->getValue();
- else
+ else if (nMinLen >= 0) // -1: optional => empty, 0: must be present, empty
{
++nError;
fprintf( stderr, "Error: node NULL pointer for parameter %s.\n",
@@ -246,12 +246,15 @@ OUString LocaleNode::writeParameterCheckLen( const OFileWriter &of,
OSTR( aVal));
}
else if (nLen > nMaxLen && nMaxLen >= 0)
+ {
+ ++nError;
fprintf( stderr,
- "Warning: more than %ld character%s (%ld) in %s %s not supported by application.\n",
+ "Error: more than %ld character%s (%ld) in %s '%s' not supported by application.\n",
sal::static_int_cast< long >(nMaxLen), (nMaxLen > 1 ? "s" : ""),
sal::static_int_cast< long >(nLen),
(pNode ? OSTR( pNode->getName()) : ""),
OSTR( aVal));
+ }
return aVal;
}
@@ -262,7 +265,7 @@ OUString LocaleNode::writeParameterCheckLen( const OFileWriter &of,
{
OUString aVal;
const LocaleNode * pNode = findNode( pNodeName);
- if (pNode)
+ if (pNode || nMinLen < 0)
aVal = writeParameterCheckLen( of, pParameterName, pNode, nMinLen, nMaxLen);
else
{
@@ -377,6 +380,8 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
writeParameterCheckLen( of, "ThousandSeparator", "thousandSeparator", 1, 1);
aDecSep =
writeParameterCheckLen( of, "DecimalSeparator", "decimalSeparator", 1, 1);
+ OUString aDecSepAlt =
+ writeParameterCheckLen( of, "DecimalSeparatorAlternative", "decimalSeparatorAlternative", -1, 1);
OUString aTimeSep =
writeParameterCheckLen( of, "TimeSeparator", "timeSeparator", 1, 1);
OUString aTime100Sep =
@@ -414,13 +419,16 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
fprintf( stderr, "Warning: %s\n",
"LongDateYearSeparator is empty. Usually this is not the case and may lead to concatenated display names like \"Wednesday, 2007May 9\".");
-
int nSavErr = nError;
int nWarn = 0;
if (aDateSep == aTimeSep)
incError( "DateSeparator equals TimeSeparator.");
if (aDecSep == aThoSep)
incError( "DecimalSeparator equals ThousandSeparator.");
+ if (aDecSepAlt == aThoSep)
+ incError( "DecimalSeparatorAlternative equals ThousandSeparator.");
+ if (aDecSepAlt == aDecSep)
+ incError( "DecimalSeparatorAlternative equals DecimalSeparator, it must not be specified then.");
if ( aThoSep == " " )
incError( "ThousandSeparator is an ' ' ordinary space, this should be a non-breaking space U+00A0 instead.");
if (aListSep == aDecSep)
@@ -572,7 +580,8 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
of.writeAsciiString("\tLongDateDayOfWeekSeparator,\n");
of.writeAsciiString("\tLongDateDaySeparator,\n");
of.writeAsciiString("\tLongDateMonthSeparator,\n");
- of.writeAsciiString("\tLongDateYearSeparator\n");
+ of.writeAsciiString("\tLongDateYearSeparator,\n");
+ of.writeAsciiString("\tdecimalSeparatorAlternative\n");
of.writeAsciiString("};\n\n");
of.writeFunction("getLocaleItem_", "SAL_N_ELEMENTS(LCType)", "LCType");
}