summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-25 19:37:35 +0100
committerEike Rathke <erack@redhat.com>2011-11-25 19:38:15 +0100
commit4e34d8fd5b64a18dd17faf4ed4d603648bab8311 (patch)
tree105f64ba3361e69173cf827c7fced45d477d73d8 /i18npool
parent58932ca2426320df5c7d7ec97cf2ad65f6539b22 (diff)
added check if locale data's usedInCompatibleFormatCodes currency is really used there
and fixed the cases discovered by the check ...
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx44
-rw-r--r--i18npool/source/localedata/LocaleNode.hxx3
-rw-r--r--i18npool/source/localedata/data/ga_IE.xml4
-rw-r--r--i18npool/source/localedata/data/my_MM.xml7
-rw-r--r--i18npool/source/localedata/data/wa_BE.xml2
5 files changed, 53 insertions, 7 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 8d7d1a30c6ed..88c26b5216af 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -337,6 +337,12 @@ void LocaleNode::incErrorStr( const char* pStr, const ::rtl::OUString& rVal ) co
fprintf( stderr, prepareErrorFormat( pStr, ": %s"), OSTR( rVal));
}
+void LocaleNode::incErrorStrStr( const char* pStr, const ::rtl::OUString& rVal1, const ::rtl::OUString& rVal2 ) const
+{
+ ++nError;
+ fprintf( stderr, prepareErrorFormat( pStr, ": %s %s"), OSTR( rVal1), OSTR( rVal2));
+}
+
void LCInfoNode::generateCode (const OFileWriter &of) const
{
@@ -590,13 +596,17 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const
}
+static OUString sTheCompatibleCurrency;
+
sal_Int16 LCFormatNode::mnSection = 0;
sal_Int16 LCFormatNode::mnFormats = 0;
void LCFormatNode::generateCode (const OFileWriter &of) const
{
OUString str;
- if (mnSection >= 2)
+ if (mnSection == 0)
+ sTheCompatibleCurrency = OUString();
+ else if (mnSection >= 2)
incError("more than 2 LC_FORMAT sections");
OUString strFrom( getAttr().getValueByName("replaceFrom"));
of.writeParameter("replaceFrom", strFrom, mnSection);
@@ -607,6 +617,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
if (str.endsWithIgnoreAsciiCaseAsciiL( "-FFFF]", 6))
incErrorStr("replaceTo=\"%s\" needs FFFF to be adapted to the real LangID value.", str);
of.writeParameter("replaceTo", str, mnSection);
+ // 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) {
switch (mnSection)
@@ -710,14 +727,27 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
}
}
break;
- // Currency formats should be something like [C]###0;-[C]###0
- // and not parenthesized [C]###0;([C]###0) if not en_US.
+ case cssi::NumberFormatIndex::CURRENCY_1000DEC2 :
+ // Remember the currency symbol if present.
+ {
+ sal_Int32 nStart;
+ if (sTheCompatibleCurrency.isEmpty() &&
+ ((nStart = n->getValue().indexOfAsciiL( "[$", 2)) >= 0))
+ {
+ OUString aCode( n->getValue());
+ sal_Int32 nHyphen = aCode.indexOf( '-', nStart);
+ if (nHyphen >= nStart + 3)
+ sTheCompatibleCurrency = aCode.copy( nStart + 2, nHyphen - nStart - 2);
+ }
+ }
+ // fallthru
case cssi::NumberFormatIndex::CURRENCY_1000INT :
case cssi::NumberFormatIndex::CURRENCY_1000INT_RED :
- case cssi::NumberFormatIndex::CURRENCY_1000DEC2 :
case cssi::NumberFormatIndex::CURRENCY_1000DEC2_RED :
case cssi::NumberFormatIndex::CURRENCY_1000DEC2_CCC :
case cssi::NumberFormatIndex::CURRENCY_1000DEC2_DASHED :
+ // Currency formats should be something like [C]###0;-[C]###0
+ // and not parenthesized [C]###0;([C]###0) if not en_US.
if (strcmp( of.getLocale(), "en_US") != 0)
{
OUString aCode( n->getValue());
@@ -1549,6 +1579,12 @@ void LCCurrencyNode :: generateCode (const OFileWriter &of) const
incError( "CurrencyID is not ISO 4217");
str = currencyNode -> findNode ("CurrencySymbol") -> getValue();
of.writeParameter("currencySymbol", str, nbOfCurrencies);
+ // Check if this currency really is the one used in number format
+ // codes. In case of ref=... mechanisms it may be that TheCurrency
+ // couldn't had been determined from the current locale (i.e. is
+ // empty), silently assume the referred locale has things right.
+ if (bCompatible && !sTheCompatibleCurrency.isEmpty() && sTheCompatibleCurrency != str)
+ incErrorStrStr( "CurrencySymbol \"%s\" flagged as usedInCompatibleFormatCodes doesn't match \"%s\" determined from format codes.", str, sTheCompatibleCurrency);
str = currencyNode -> findNode ("BankSymbol") -> getValue();
of.writeParameter("bankSymbol", str, nbOfCurrencies);
// BankSymbol currently must be ISO 4217. May change later if
diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx
index fb3506389ac4..c79726cf12f9 100644
--- a/i18npool/source/localedata/LocaleNode.hxx
+++ b/i18npool/source/localedata/LocaleNode.hxx
@@ -152,6 +152,9 @@ public:
void incErrorInt( const char* pStr, int nVal ) const;
// ++nError with output to stderr, pStr should contain "%s", otherwise appended
void incErrorStr( const char* pStr, const ::rtl::OUString& rVal ) const;
+ // ++nError with output to stderr, pStr should contain "%s %s", otherwise
+ // appended
+ void incErrorStrStr( const char* pStr, const ::rtl::OUString& rVal1, const ::rtl::OUString& rVal2 ) const;
// used by incError...(), returns a pointer to a static buffer,
// pDefaultConversion is appended if pFormat doesn't contain a %
// specification and should be something like ": %d" or ": %s" or similar.
diff --git a/i18npool/source/localedata/data/ga_IE.xml b/i18npool/source/localedata/data/ga_IE.xml
index 89ab1e06f3be..f397241aca38 100644
--- a/i18npool/source/localedata/data/ga_IE.xml
+++ b/i18npool/source/localedata/data/ga_IE.xml
@@ -149,14 +149,14 @@
<CurrencyName>Euro</CurrencyName>
<DecimalPlaces>2</DecimalPlaces>
</Currency>
- <Currency default="false" usedInCompatibleFormatCodes="true">
+ <Currency default="false" usedInCompatibleFormatCodes="false">
<CurrencyID>IEP</CurrencyID>
<CurrencySymbol>IR£</CurrencySymbol>
<BankSymbol>IEP</BankSymbol>
<CurrencyName>Punt Éireannach</CurrencyName>
<DecimalPlaces>2</DecimalPlaces>
</Currency>
- <Currency default="false" usedInCompatibleFormatCodes="false">
+ <Currency default="false" usedInCompatibleFormatCodes="true">
<CurrencyID>GBP</CurrencyID>
<CurrencySymbol>£</CurrencySymbol>
<BankSymbol>GBP</BankSymbol>
diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml
index 6c12c8986c8f..17c50faf87da 100644
--- a/i18npool/source/localedata/data/my_MM.xml
+++ b/i18npool/source/localedata/data/my_MM.xml
@@ -387,6 +387,13 @@
<LC_CURRENCY>
<Currency default="true" usedInCompatibleFormatCodes="true">
<CurrencyID>MMK</CurrencyID>
+ <CurrencySymbol>ကျပ်</CurrencySymbol>
+ <BankSymbol>MMK</BankSymbol>
+ <CurrencyName>Kyat</CurrencyName>
+ <DecimalPlaces>2</DecimalPlaces>
+ </Currency>
+ <Currency default="false" usedInCompatibleFormatCodes="false" legacyOnly="true">
+ <CurrencyID>MMK</CurrencyID>
<CurrencySymbol>K</CurrencySymbol>
<BankSymbol>MMK</BankSymbol>
<CurrencyName>Kyat</CurrencyName>
diff --git a/i18npool/source/localedata/data/wa_BE.xml b/i18npool/source/localedata/data/wa_BE.xml
index aa994829dc2f..eb3bf51a8e1c 100644
--- a/i18npool/source/localedata/data/wa_BE.xml
+++ b/i18npool/source/localedata/data/wa_BE.xml
@@ -34,7 +34,7 @@
<TimePM>PM</TimePM>
<MeasurementSystem>metric</MeasurementSystem>
</LC_CTYPE>
- <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-633]">
+ <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$FB-633]">
<FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0">
<FormatCode>Standard</FormatCode>
</FormatElement>