summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-12-14 17:46:54 +0100
committerEike Rathke <erack@redhat.com>2011-12-14 17:53:37 +0100
commit736b9e76fb62fb5371265509324c8ac5ab28caf2 (patch)
treedd2a76e301f6d510f18e841a2e073fb3c5e6e824 /i18npool
parent454b962207f974df2dd912ba226e6f49390b14a3 (diff)
check if [CURRENCY] replaceTo is specified
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index cabe21fa9da0..4d107ed894e0 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -594,6 +594,7 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
}
+static OUString sTheCurrencyReplaceTo;
static OUString sTheCompatibleCurrency;
sal_Int16 LCFormatNode::mnSection = 0;
@@ -603,7 +604,10 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
{
OUString str;
if (mnSection == 0)
+ {
+ sTheCurrencyReplaceTo = OUString();
sTheCompatibleCurrency = OUString();
+ }
else if (mnSection >= 2)
incError("more than 2 LC_FORMAT sections");
OUString strFrom( getAttr().getValueByName("replaceFrom"));
@@ -612,15 +616,20 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
if (strFrom.getLength() && !str.getLength())
incErrorStr("replaceFrom=\"%s\" replaceTo=\"\" is empty replacement.", strFrom);
// Locale data generator inserts FFFF for LangID, we need to adapt that.
- if (str.endsWithIgnoreAsciiCaseAsciiL( "-FFFF]", 6))
+ if (str.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "-FFFF]")))
incErrorStr("replaceTo=\"%s\" needs FFFF to be adapted to the real LangID value.", str);
of.writeParameter("replaceTo", str, mnSection);
+ // Remember the replaceTo value for "[CURRENCY]" to check format codes.
+ if (strFrom.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "[CURRENCY]")))
+ sTheCurrencyReplaceTo = str;
// Remember the currency symbol if present.
if (str.indexOfAsciiL( "[$", 2) == 0)
{
sal_Int32 nHyphen = str.indexOf( '-');
if (nHyphen >= 3)
+ {
sTheCompatibleCurrency = str.copy( 2, nHyphen - 2);
+ }
}
::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
@@ -757,6 +766,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
aCode.indexOf( aPar3 ) > 0 || aCode.indexOf( aPar4 ) > 0)
fprintf( stderr, "Warning: FormatCode formatindex=\"%d\" for currency uses parentheses for negative amounts, which probably is not correct for locales not based on en_US.\n", formatindex);
}
+ // Check if we have replaceTo for "[CURRENCY]" placeholder.
+ if (sTheCurrencyReplaceTo.isEmpty())
+ {
+ OUString aCode( n->getValue());
+ if (aCode.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "[CURRENCY]")) >= 0)
+ incErrorInt( "[CURRENCY] replaceTo not found for formatindex=\"%d\".", formatindex);
+ }
break;
}
if (pCtype)