diff options
author | Marek Safar <marek.safar@gmail.com> | 2013-11-12 14:53:10 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2013-11-12 23:12:34 +0400 |
commit | ff631b91cc0a874e6b26bd1d8184ba2369b8dcbe (patch) | |
tree | 77a6fda06ffc141550463894707e903a45b4d388 /tools | |
parent | ebe4dd413e991ae9b2adf519bc8059e3a6a246e0 (diff) |
Extract CurrencyDecimalDigits using currency and not territory info. Fixes #15895
Diffstat (limited to 'tools')
-rw-r--r-- | tools/locale-builder/CultureInfoEntry.cs | 6 | ||||
-rw-r--r-- | tools/locale-builder/Driver.cs | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/tools/locale-builder/CultureInfoEntry.cs b/tools/locale-builder/CultureInfoEntry.cs index 4aefd7cc943..f03d93a8366 100644 --- a/tools/locale-builder/CultureInfoEntry.cs +++ b/tools/locale-builder/CultureInfoEntry.cs @@ -65,6 +65,12 @@ namespace Mono.Tools.LocaleBuilder public bool HasMissingLocale { get; set; } + public bool IsNeutral { + get { + return Territory == null; + } + } + public string OriginalName { get; set; } public CultureInfoEntry Parent { get; set; } diff --git a/tools/locale-builder/Driver.cs b/tools/locale-builder/Driver.cs index 16368ce288f..79976fa6c55 100644 --- a/tools/locale-builder/Driver.cs +++ b/tools/locale-builder/Driver.cs @@ -429,11 +429,6 @@ namespace Mono.Tools.LocaleBuilder ci.DateTimeFormatEntry.CalendarWeekRule = (int) rule; } - string fraction_value; - if (currency_fractions.TryGetValue (ci.Territory, out fraction_value)) { - ci.NumberFormatEntry.CurrencyDecimalDigits = fraction_value; - } - RegionInfoEntry region = regions.Where (l => l.Name == ci.Territory).FirstOrDefault (); if (region == null) { region = new RegionInfoEntry () { @@ -466,6 +461,11 @@ namespace Mono.Tools.LocaleBuilder regions.Add (region); } + string fraction_value; + if (currency_fractions.TryGetValue (region.ISOCurrencySymbol, out fraction_value)) { + ci.NumberFormatEntry.CurrencyDecimalDigits = fraction_value; + } + ci.RegionInfoEntry = region; } @@ -587,7 +587,7 @@ namespace Mono.Tools.LocaleBuilder case "zh-Hant": nfe.CurrencySymbol = "HK$"; break; - + default: var all_currencies = new List<string> (); GetAllChildrenValues (ci, all_currencies, l => l.NumberFormatEntry.CurrencySymbol); @@ -622,6 +622,8 @@ namespace Mono.Tools.LocaleBuilder Console.WriteLine ("No currency decimal digits data for `{0}'", ci.Name); nfe.CurrencyDecimalDigits = "2"; + } else if (ci.IsNeutral) { + nfe.CurrencyDecimalDigits = "2"; } else { // .NET has weird concept of territory data available for neutral cultures (e.g. en, es, pt) // We have to manually disambiguate the correct entry (which is artofficial anyway) |