Skip to content

Commit

Permalink
2004-06-05 Atsushi Enomoto <[email protected]>
Browse files Browse the repository at this point in the history
	* Driver.cs :
	  - NumberDecimalDigits are almost differently specified by locale
	    xml files. Almost all of them have ".###", but we need ".##" in
	    almost all the locale. So let's *assume* that the number of
	    digit is always +1 extraneous by this Driver itself.
	    This change accompanies with some existing supp/*.xml changes.

	  - For decimal patterns and currency patterns, when numeric patterns
	    does not have ';'-separated patterns, it ignored the whole pattern
	    string. Fixed it by just copying the same patterns.

	  - When parsing percent patterns, '%' characters were in the way.
	  - When the decimal part of the percent pattern ends with ".##0",
	    the value of PercentDecimalDigits is 2.
	  - Assume PercentDecimalDigits as 2 by default.

svn path=/trunk/mono/; revision=28870
  • Loading branch information
atsushieno committed Jun 5, 2004
1 parent 4e222e0 commit 6f7c718
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
20 changes: 19 additions & 1 deletion tools/locale-builder/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
2004-06-03 Atsushi Enomoto <[email protected]>
2004-06-05 Atsushi Enomoto <[email protected]>

* Driver.cs :
- NumberDecimalDigits are almost differently specified by locale
xml files. Almost all of them have ".###", but we need ".##" in
almost all the locale. So let's *assume* that the number of
digit is always +1 extraneous by this Driver itself.
This change accompanies with some existing supp/*.xml changes.

- For decimal patterns and currency patterns, when numeric patterns
does not have ';'-separated patterns, it ignored the whole pattern
string. Fixed it by just copying the same patterns.

- When parsing percent patterns, '%' characters were in the way.
- When the decimal part of the percent pattern ends with ".##0",
the value of PercentDecimalDigits is 2.
- Assume PercentDecimalDigits as 2 by default.

2004-06-05 Atsushi Enomoto <[email protected]>

* Driver.cs : Let's ignore DTD that takes most of the running time.

Expand Down
36 changes: 27 additions & 9 deletions tools/locale-builder/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,17 @@ private void LookupDecimalFormat (XPathNavigator nav, CultureInfoEntry ci)

string [] part_one, part_two;
string [] pos_neg = format.Split (new char [1] {';'}, 2);


// Most of the patterns are common in positive and negative
if (pos_neg.Length == 1)
pos_neg = new string [] {pos_neg [0], pos_neg [0]};

if (pos_neg.Length == 2) {

part_one = pos_neg [0].Split (new char [1] {'.'}, 2);

if (part_one.Length == 1)
part_one = new string [] {part_one [0], String.Empty};

if (part_one.Length == 2) {
// assumed same for both positive and negative
// decimal digit side
Expand All @@ -515,8 +521,10 @@ private void LookupDecimalFormat (XPathNavigator nav, CultureInfoEntry ci)
if (part_one [1][i] == '#') {
ci.NumberFormatEntry.NumberDecimalDigits ++;
} else
break;
}
break; }
// FIXME: This should be actually done by modifying culture xml files, but too many files to be modified.
if (ci.NumberFormatEntry.NumberDecimalDigits > 0)
ci.NumberFormatEntry.NumberDecimalDigits --;

// decimal grouping side
part_two = part_one [0].Split (',');
Expand Down Expand Up @@ -563,19 +571,23 @@ private void LookupPercentFormat (XPathNavigator nav, CultureInfoEntry ci)
if (format.StartsWith ("%")) {
ci.NumberFormatEntry.PercentPositivePattern = 2;
ci.NumberFormatEntry.PercentNegativePattern = 2;
format = format.Substring (1);
} else if (format.EndsWith (" %")) {
ci.NumberFormatEntry.PercentPositivePattern = 0;
ci.NumberFormatEntry.PercentNegativePattern = 0;
format = format.Substring (0, format.Length - 2);
} else if (format.EndsWith ("%")) {
ci.NumberFormatEntry.PercentPositivePattern = 1;
ci.NumberFormatEntry.PercentNegativePattern = 1;
format = format.Substring (0, format.Length - 1);
} else {
ci.NumberFormatEntry.PercentPositivePattern = 0;
ci.NumberFormatEntry.PercentNegativePattern = 0;
}

part_one = format.Split (new char [1] {'.'}, 2);

if (part_one.Length == 1)
part_one = new string [] {part_one [0], String.Empty};
if (part_one.Length == 2) {
// assumed same for both positive and negative
// decimal digit side
Expand All @@ -586,18 +598,20 @@ private void LookupPercentFormat (XPathNavigator nav, CultureInfoEntry ci)
else
break;
}

// percent grouping side
part_two = part_one [0].Split (',');
if (part_two.Length > 1) {
int len = part_two.Length - 1;
ci.NumberFormatEntry.PercentGroupSizes = new int [len];
for (int i = 0; i < len; i++) {
string pat = part_two [i + 1];
if (pat [pat.Length -1] == '0')
ci.NumberFormatEntry.PercentDecimalDigits = pat.Length - 1;
ci.NumberFormatEntry.PercentGroupSizes [i] = pat.Length;
}
} else {
ci.NumberFormatEntry.PercentGroupSizes = new int [1] { 3 };
ci.NumberFormatEntry.PercentDecimalDigits = 2;
}
}
}
Expand All @@ -612,11 +626,15 @@ private void LookupCurrencyFormat (XPathNavigator nav, CultureInfoEntry ci)

string [] part_one, part_two;
string [] pos_neg = format.Split (new char [1] {';'}, 2);

pos_neg = format.Split (new char [1] {';'}, 2);

// Most of the patterns are common in positive and negative
if (pos_neg.Length == 1)
pos_neg = new string [] {pos_neg [0], pos_neg [0]};

if (pos_neg.Length == 2) {
part_one = pos_neg [0].Split (new char [1] {'.'}, 2);

if (part_one.Length == 1)
part_one = new string [] {part_one [0], String.Empty};
if (part_one.Length == 2) {
// assumed same for both positive and negative
// decimal digit side
Expand Down

0 comments on commit 6f7c718

Please sign in to comment.