[Libreoffice-commits] .: 2 commits - i18npool/source
Eike Rathke
erack at kemper.freedesktop.org
Wed Dec 14 08:53:51 PST 2011
i18npool/source/localedata/LocaleNode.cxx | 18 +++++++++++++++++-
i18npool/source/localedata/data/sl_SI.xml | 2 +-
2 files changed, 18 insertions(+), 2 deletions(-)
New commits:
commit 9e77c269b6a0fc1e84812f4817c3c58a01347f29
Author: Eike Rathke <erack at redhat.com>
Date: Wed Dec 14 17:46:55 2011 +0100
if [CURRENCY] is used then it must be defined
diff --git a/i18npool/source/localedata/data/sl_SI.xml b/i18npool/source/localedata/data/sl_SI.xml
index e95325e..04c3baa 100644
--- a/i18npool/source/localedata/data/sl_SI.xml
+++ b/i18npool/source/localedata/data/sl_SI.xml
@@ -34,7 +34,7 @@
<TimePM>pop.</TimePM>
<MeasurementSystem>metric</MeasurementSystem>
</LC_CTYPE>
- <LC_FORMAT>
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$SIT-424]">
<FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
<FormatCode>Standard</FormatCode>
</FormatElement>
commit 736b9e76fb62fb5371265509324c8ac5ab28caf2
Author: Eike Rathke <erack at redhat.com>
Date: Wed Dec 14 17:46:54 2011 +0100
check if [CURRENCY] replaceTo is specified
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index cabe21f..4d107ed 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)
More information about the Libreoffice-commits
mailing list