/// <summary> /// Currencies{ /// ... /// USD{ /// "US$", => symbol /// "US Dollar", => display name /// } /// ... /// ESP{ /// "₧", => symbol /// "pesseta espanyola", => display name /// { /// "¤ #,##0.00", => currency-specific pattern /// ",", => currency-specific grouping separator /// ".", => currency-specific decimal separator /// } /// } /// ... /// } /// </summary> internal void ConsumeCurrenciesTable(UResource.Key key, UResource.Value value) { // The full Currencies table is consumed for parsing only. Debug.Assert(parsingData != null); UResource.ITable table = value.GetTable(); for (int i = 0; table.GetKeyAndValue(i, key, value); i++) { string isoCode = key.ToString(); if (value.Type != UResourceBundle.ARRAY) { throw new ICUException("Unexpected data type in Currencies table for " + isoCode); } UResource.IArray array = value.GetArray(); parsingData.symbolToIsoCode[isoCode] = isoCode; // Add the ISO code itself as a symbol array.GetValue(0, value); parsingData.symbolToIsoCode[value.GetString()] = isoCode; array.GetValue(1, value); parsingData.nameToIsoCode[value.GetString()] = isoCode; } }
internal void ConsumeCurrenciesEntry(UResource.Key key, UResource.Value value) { Debug.Assert(formattingData != null); string isoCode = key.ToString(); if (value.Type != UResourceBundle.ARRAY) { throw new ICUException("Unexpected data type in Currencies table for " + isoCode); } UResource.IArray array = value.GetArray(); if (formattingData.symbol == null) { array.GetValue(0, value); formattingData.symbol = value.GetString(); } if (formattingData.displayName == null) { array.GetValue(1, value); formattingData.displayName = value.GetString(); } // If present, the third element is the currency format info. // TODO: Write unit test to ensure that this data is being used by number formatting. if (array.Length > 2 && formattingData.formatInfo == null) { array.GetValue(2, value); UResource.IArray formatArray = value.GetArray(); formatArray.GetValue(0, value); string formatPattern = value.GetString(); formatArray.GetValue(1, value); string decimalSeparator = value.GetString(); formatArray.GetValue(2, value); string groupingSeparator = value.GetString(); formattingData.formatInfo = new CurrencyFormatInfo( isoCode, formatPattern, decimalSeparator, groupingSeparator); } }