Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -144,6 +144,7 @@ |
145 | 145 | * (bug 5761) Project talk namespace broken in Xal, Os, Udm and Cv |
146 | 146 | * Rewrite reassignEdits script to be more efficient; support optional updates to |
147 | 147 | recent changes table; add reporting and silent modes |
| 148 | +* Cleaned up formatNum usage in langfiles |
148 | 149 | |
149 | 150 | == Compatibility == |
150 | 151 | |
Index: trunk/phase3/languages/LanguageEl.php |
— | — | @@ -73,9 +73,10 @@ |
74 | 74 | return 'iso-8859-7'; |
75 | 75 | } |
76 | 76 | |
77 | | - function formatNum( $number, $year = false ) { |
78 | | - return $year ? $number : strtr($this->commafy( $number ), '.,', ',.' ); |
| 77 | + function separatorTransformTable() { |
| 78 | + return array(',' => '.', '.' => ',' ); |
79 | 79 | } |
| 80 | + |
80 | 81 | } |
81 | 82 | |
82 | 83 | ?> |
Index: trunk/phase3/languages/LanguageAs.php |
— | — | @@ -8,27 +8,20 @@ |
9 | 9 | require_once( 'LanguageUtf8.php' ); |
10 | 10 | |
11 | 11 | class LanguageAs extends LanguageUtf8 { |
12 | | - var $digitTransTable = array( |
13 | | - '0' => '০', |
14 | | - '1' => '১', |
15 | | - '2' => '২', |
16 | | - '3' => '৩', |
17 | | - '4' => '৪', |
18 | | - '5' => '৫', |
19 | | - '6' => '৬', |
20 | | - '7' => '৭', |
21 | | - '8' => '৮', |
22 | | - '9' => '৯' |
23 | | - ); |
24 | | - |
25 | | - function formatNum( $number ) { |
26 | | - global $wgTranslateNumerals; |
27 | | - if( $wgTranslateNumerals ) { |
28 | | - return strtr( $number, $this->digitTransTable ); |
29 | | - } else { |
30 | | - return $number; |
31 | | - } |
| 12 | + function digitTransformTable() { |
| 13 | + return array( |
| 14 | + '0' => '০', |
| 15 | + '1' => '১', |
| 16 | + '2' => '২', |
| 17 | + '3' => '৩', |
| 18 | + '4' => '৪', |
| 19 | + '5' => '৫', |
| 20 | + '6' => '৬', |
| 21 | + '7' => '৭', |
| 22 | + '8' => '৮', |
| 23 | + '9' => '৯' |
| 24 | + ); |
32 | 25 | } |
33 | | -} |
34 | 26 | |
| 27 | +} |
35 | 28 | ?> |
Index: trunk/phase3/languages/LanguageSr_el.php |
— | — | @@ -162,8 +162,8 @@ |
163 | 163 | return $wgMagicWordsSr_el; |
164 | 164 | } |
165 | 165 | |
166 | | - function formatNum( $number, $year = false ) { |
167 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 166 | + function separatorTransformTable() { |
| 167 | + return array(',' => '.', '.' => ',' ); |
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
— | — | @@ -278,5 +278,4 @@ |
279 | 279 | } |
280 | 280 | |
281 | 281 | } |
282 | | - |
283 | 282 | ?> |
Index: trunk/phase3/languages/LanguageEt.php |
— | — | @@ -151,8 +151,8 @@ |
152 | 152 | * Estonian numeric formatting is 123 456,78. |
153 | 153 | * Notice that the space is non-breaking. |
154 | 154 | */ |
155 | | - function formatNum( $number, $year = false ) { |
156 | | - return $year ? $number : strtr($this->commafy($number), '.,', ", " ); |
| 155 | + function separatorTransformTable() { |
| 156 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
Index: trunk/phase3/languages/LanguageMl.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageMl extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '൦', |
16 | | - '1' => '൧', |
17 | | - '2' => '൨', |
18 | | - '3' => '൩', |
19 | | - '4' => '൪', |
20 | | - '5' => '൫', |
21 | | - '6' => '൬', |
22 | | - '7' => '൭', |
23 | | - '8' => '൮', |
24 | | - '9' => '൯' |
25 | | - ); |
26 | | - |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 14 | + function digitTransformTable() { |
| 15 | + return array( |
| 16 | + '0' => '൦', |
| 17 | + '1' => '൧', |
| 18 | + '2' => '൨', |
| 19 | + '3' => '൩', |
| 20 | + '4' => '൪', |
| 21 | + '5' => '൫', |
| 22 | + '6' => '൬', |
| 23 | + '7' => '൭', |
| 24 | + '8' => '൮', |
| 25 | + '9' => '൯' |
| 26 | + ); |
34 | 27 | } |
| 28 | + |
35 | 29 | } |
36 | 30 | |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguageIs.php |
— | — | @@ -158,8 +158,8 @@ |
159 | 159 | * The Icelandic number style uses dots where English would use commas |
160 | 160 | * and commas where English would use dots, e.g. 201.511,17 not 201,511.17 |
161 | 161 | */ |
162 | | - function formatNum( $number, $year = false ) { |
163 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 162 | + function separatorTransformTable() { |
| 163 | + return array(',' => '.', '.' => ',' ); |
164 | 164 | } |
165 | 165 | |
166 | 166 | function linkPrefixExtension() { |
Index: trunk/phase3/languages/LanguageNds.php |
— | — | @@ -134,9 +134,9 @@ |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | | - function formatNum( $number, $year = false ) { |
139 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 138 | + function separatorTransformTable() { |
| 139 | + return array(',' => '.', '.' => ',' ); |
140 | 140 | } |
| 141 | + |
141 | 142 | } |
142 | | - |
143 | 143 | ?> |
Index: trunk/phase3/languages/LanguageFa.php |
— | — | @@ -55,21 +55,23 @@ |
56 | 56 | #-------------------------------------------------------------------------- |
57 | 57 | |
58 | 58 | class LanguageFa extends LanguageUtf8 { |
59 | | - var $digitTransTable = array( |
60 | | - "0" => "۰", |
61 | | - "1" => "۱", |
62 | | - "2" => "۲", |
63 | | - "3" => "۳", |
64 | | - "4" => "۴", |
65 | | - "5" => "۵", |
66 | | - "6" => "۶", |
67 | | - "7" => "۷", |
68 | | - "8" => "۸", |
69 | | - "9" => "۹", |
70 | | - "%" => "٪", |
71 | | - "." => "٫", |
72 | | - "," => "٬" |
73 | | - ); |
| 59 | + function digitTransformTable() { |
| 60 | + return array( |
| 61 | + "0" => "۰", |
| 62 | + "1" => "۱", |
| 63 | + "2" => "۲", |
| 64 | + "3" => "۳", |
| 65 | + "4" => "۴", |
| 66 | + "5" => "۵", |
| 67 | + "6" => "۶", |
| 68 | + "7" => "۷", |
| 69 | + "8" => "۸", |
| 70 | + "9" => "۹", |
| 71 | + "%" => "٪", |
| 72 | + "." => "٫", // wrong table? |
| 73 | + "," => "٬" |
| 74 | + ); |
| 75 | + } |
74 | 76 | |
75 | 77 | function getDefaultUserOptions() { |
76 | 78 | $opt = Language::getDefaultUserOptions(); |
— | — | @@ -104,15 +106,6 @@ |
105 | 107 | # For right-to-left language support |
106 | 108 | function isRTL() { return true; } |
107 | 109 | |
108 | | - function formatNum( $number ) { |
109 | | - global $wgTranslateNumerals; |
110 | | - if( $wgTranslateNumerals ) { |
111 | | - return strtr( $number, $this->digitTransTable ); |
112 | | - } else { |
113 | | - return $number; |
114 | | - } |
115 | | - } |
116 | | - |
117 | 110 | function timeanddate( $ts, $adj = false ) { |
118 | 111 | return $this->formatNum( Language::timeanddate( $ts, $adj ) ); |
119 | 112 | } |
Index: trunk/phase3/languages/LanguageFi.php |
— | — | @@ -175,10 +175,9 @@ |
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Finnish numeric formatting is 123 456,78. |
179 | | - * Notice that the space is non-breaking. |
180 | 179 | */ |
181 | | - function formatNum( $number, $year = false ) { |
182 | | - return $year ? $number : strtr($this->commafy($number), '.,', ", " ); |
| 180 | + function separatorTransformTable() { |
| 181 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
183 | 182 | } |
184 | 183 | |
185 | 184 | /** |
Index: trunk/phase3/languages/LanguageBn.php |
— | — | @@ -47,31 +47,25 @@ |
48 | 48 | return $wgDateFormatsBn; |
49 | 49 | } |
50 | 50 | |
51 | | - var $digitTransTable = array( |
52 | | - '0' => '০', |
53 | | - '1' => '১', |
54 | | - '2' => '২', |
55 | | - '3' => '৩', |
56 | | - '4' => '৪', |
57 | | - '5' => '৫', |
58 | | - '6' => '৬', |
59 | | - '7' => '৭', |
60 | | - '8' => '৮', |
61 | | - '9' => '৯' |
62 | | - ); |
63 | | - |
64 | | - function formatNum( $number ) { |
65 | | - global $wgTranslateNumerals; |
66 | | - if( $wgTranslateNumerals ) { |
67 | | - return strtr( $number, $this->digitTransTable ); |
68 | | - } else { |
69 | | - return $number; |
70 | | - } |
| 51 | + function digitTransformTable() { |
| 52 | + return array( |
| 53 | + '0' => '০', |
| 54 | + '1' => '১', |
| 55 | + '2' => '২', |
| 56 | + '3' => '৩', |
| 57 | + '4' => '৪', |
| 58 | + '5' => '৫', |
| 59 | + '6' => '৬', |
| 60 | + '7' => '৭', |
| 61 | + '8' => '৮', |
| 62 | + '9' => '৯' |
| 63 | + ); |
71 | 64 | } |
72 | 65 | |
73 | 66 | function timeanddate( $ts, $adj = false ) { |
74 | 67 | return $this->formatNum( Language::timeanddate( $ts, $adj ) ); |
75 | 68 | } |
| 69 | + |
76 | 70 | } |
77 | 71 | |
78 | 72 | ?> |
Index: trunk/phase3/languages/LanguageBr.php |
— | — | @@ -108,13 +108,8 @@ |
109 | 109 | return $this->date( $ts, $adj ) . " da " . $this->time( $ts, $adj ); |
110 | 110 | } |
111 | 111 | |
112 | | - var $digitTransTable = array( |
113 | | - ',' => "\xc2\xa0", // @bug 2749 |
114 | | - '.' => ',' |
115 | | - ); |
116 | | - |
117 | | - function formatNum( $number, $year = false ) { |
118 | | - return $year ? $number : strtr($this->commafy($number), $this->digitTransTable ); |
| 112 | + function separatorTransformTable() { |
| 113 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
119 | 114 | } |
120 | 115 | |
121 | 116 | function getMessage( $key ) { |
Index: trunk/phase3/languages/LanguageNo.php |
— | — | @@ -92,8 +92,8 @@ |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | | - function formatNum( $number, $year = false ) { |
97 | | - return !$year ? strtr($number, '.,', ',.' ) : $number; |
| 96 | + function separatorTransformTable() { |
| 97 | + return array(',' => '.', '.' => ',' ); |
98 | 98 | } |
99 | 99 | |
100 | 100 | function getMessage( $key ) { |
Index: trunk/phase3/languages/LanguageFy.php |
— | — | @@ -87,14 +87,8 @@ |
88 | 88 | return $wgSkinNamesFy; |
89 | 89 | } |
90 | 90 | |
91 | | - |
92 | | - var $digitTransTable = array( |
93 | | - ',' => '.', |
94 | | - '.' => ',' |
95 | | - ); |
96 | | - |
97 | | - function formatNum( $number, $year = false ) { |
98 | | - return !$year ? strtr($this->commafy($number), $this->digitTransTable ) : $number; |
| 91 | + function separatorTransformTable() { |
| 92 | + return array(',' => '.', '.' => ',' ); |
99 | 93 | } |
100 | 94 | |
101 | 95 | function getDateFormats() { |
Index: trunk/phase3/languages/LanguageVi.php |
— | — | @@ -178,16 +178,10 @@ |
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | | - var $digitTransTable = array( |
183 | | - ',' => '.', |
184 | | - '.' => ',' |
185 | | - ); |
186 | | - |
187 | | - function formatNum( $number, $year = false ) { |
188 | | - return !$year ? strtr($this->commafy($number), $this->digitTransTable ) : $number; |
| 182 | + function separatorTransformTable() { |
| 183 | + return array(',' => '.', '.' => ',' ); |
189 | 184 | } |
190 | 185 | |
191 | | - |
192 | 186 | function getDateFormats() { |
193 | 187 | global $wgDateFormatsVi; |
194 | 188 | return $wgDateFormatsVi; |
Index: trunk/phase3/languages/LanguageCa.php |
— | — | @@ -77,8 +77,8 @@ |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | | - function formatNum( $number, $year = false ) { |
82 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 81 | + function separatorTransformTable() { |
| 82 | + return array(',' => '.', '.' => ',' ); |
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
Index: trunk/phase3/languages/LanguageFur.php |
— | — | @@ -77,16 +77,10 @@ |
78 | 78 | return $this->date( $ts, $adj ) . " a lis " . $this->time( $ts, $adj ); |
79 | 79 | } |
80 | 80 | |
81 | | - var $digitTransTable = array( |
82 | | - ',' => "\xc2\xa0", // @bug 2749 |
83 | | - '.' => ',' |
84 | | - ); |
85 | | - |
86 | | - function formatNum( $number, $year = false ) { |
87 | | - return $year? $number : strtr($this->commafy($number), $this->digitTransTable); |
| 81 | + function separatorTransformTable() { |
| 82 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
88 | 83 | } |
89 | 84 | |
90 | | - |
91 | 85 | function getMessage( $key ) { |
92 | 86 | global $wgAllMessagesFur; |
93 | 87 | if( isset( $wgAllMessagesFur[$key] ) ) { |
Index: trunk/phase3/languages/LanguageCs.php |
— | — | @@ -186,13 +186,8 @@ |
187 | 187 | return $s; |
188 | 188 | } |
189 | 189 | |
190 | | - var $digitTransTable = array( |
191 | | - ',' => "\xc2\xa0", // @bug 2749 |
192 | | - '.' => ',' |
193 | | - ); |
194 | | - |
195 | | - function formatNum( $number, $year = false ) { |
196 | | - return $year ? $number : strtr($this->commafy($number), $this->digitTransTable); |
| 190 | + function separatorTransformTable() { |
| 191 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
197 | 192 | } |
198 | 193 | |
199 | 194 | # Grammatical transformations, needed for inflected languages |
Index: trunk/phase3/languages/LanguageKm.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageKm extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '០', |
16 | | - '1' => '១', |
17 | | - '2' => '២', |
18 | | - '3' => '៣', |
19 | | - '4' => '៤', |
20 | | - '5' => '៥', |
21 | | - '6' => '៦', |
22 | | - '7' => '៧', |
23 | | - '8' => '៨', |
24 | | - '9' => '៩' |
25 | | - ); |
26 | | - |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 14 | + function digitTransformTable() { |
| 15 | + return array( |
| 16 | + '0' => '០', |
| 17 | + '1' => '១', |
| 18 | + '2' => '២', |
| 19 | + '3' => '៣', |
| 20 | + '4' => '៤', |
| 21 | + '5' => '៥', |
| 22 | + '6' => '៦', |
| 23 | + '7' => '៧', |
| 24 | + '8' => '៨', |
| 25 | + '9' => '៩' |
| 26 | + ); |
34 | 27 | } |
| 28 | + |
35 | 29 | } |
36 | 30 | |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguageSk.php |
— | — | @@ -167,13 +167,11 @@ |
168 | 168 | return parent::getMessage( $key ); |
169 | 169 | } |
170 | 170 | |
171 | | - var $digitTransTable = array( |
172 | | - ',' => "\xc2\xa0", |
173 | | - '.' => ',' |
174 | | - ); |
175 | | - |
176 | | - function formatNum( $number, $year = false ) { |
177 | | - return $year ? $number : strtr($this->commafy($number), $this->digitTransTable ); |
| 171 | + function separatorTransformTable() { |
| 172 | + return array( |
| 173 | + ',' => "\xc2\xa0", |
| 174 | + '.' => ',' |
| 175 | + ); |
178 | 176 | } |
179 | 177 | |
180 | 178 | # Convert from the nominative form of a noun to some other case |
Index: trunk/phase3/languages/LanguageOr.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageOr extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '୦', |
16 | | - '1' => '୧', |
17 | | - '2' => '୨', |
18 | | - '3' => '୩', |
19 | | - '4' => '୪', |
20 | | - '5' => '୫', |
21 | | - '6' => '୬', |
22 | | - '7' => '୭', |
23 | | - '8' => '୮', |
24 | | - '9' => '୯', |
25 | | - ); |
26 | 14 | |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 15 | + function digitTransformTable() { |
| 16 | + return array( |
| 17 | + '0' => '୦', |
| 18 | + '1' => '୧', |
| 19 | + '2' => '୨', |
| 20 | + '3' => '୩', |
| 21 | + '4' => '୪', |
| 22 | + '5' => '୫', |
| 23 | + '6' => '୬', |
| 24 | + '7' => '୭', |
| 25 | + '8' => '୮', |
| 26 | + '9' => '୯', |
| 27 | + ); |
34 | 28 | } |
35 | | -} |
36 | 29 | |
| 30 | +} |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguageSq.php |
— | — | @@ -106,11 +106,9 @@ |
107 | 107 | return parent::getMessage($key); |
108 | 108 | } |
109 | 109 | |
110 | | - function formatNum( $number ) { |
111 | | - global $wgTranslateNumerals; |
112 | | - return $wgTranslateNumerals ? strtr($number, '.,', ',.' ) : $number; |
| 110 | + function separatorTransformTable() { |
| 111 | + return array(',' => '.', '.' => ',' ); |
113 | 112 | } |
114 | 113 | |
115 | 114 | } |
116 | | - |
117 | 115 | ?> |
Index: trunk/phase3/languages/LanguageUdm.php |
— | — | @@ -69,8 +69,8 @@ |
70 | 70 | return "windows-1251"; |
71 | 71 | } |
72 | 72 | |
73 | | - function formatNum( $number, $year = false ) { |
74 | | - return !$year ? strtr($number, '.,', ', ' ) : $number; |
| 73 | + function separatorTransformTable() { |
| 74 | + return array(',' => ' ', '.' => ',' ); |
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
Index: trunk/phase3/languages/LanguageHi.php |
— | — | @@ -31,18 +31,20 @@ |
32 | 32 | |
33 | 33 | |
34 | 34 | class LanguageHi extends LanguageUtf8 { |
35 | | - var $digitTransTable = array( |
36 | | - "0" => "०", |
37 | | - "1" => "१", |
38 | | - "2" => "२", |
39 | | - "3" => "३", |
40 | | - "4" => "४", |
41 | | - "5" => "५", |
42 | | - "6" => "६", |
43 | | - "7" => "७", |
44 | | - "8" => "८", |
45 | | - "9" => "९" |
46 | | - ); |
| 35 | + function digitTransformTable() { |
| 36 | + return array( |
| 37 | + "0" => "०", |
| 38 | + "1" => "१", |
| 39 | + "2" => "२", |
| 40 | + "3" => "३", |
| 41 | + "4" => "४", |
| 42 | + "5" => "५", |
| 43 | + "6" => "६", |
| 44 | + "7" => "७", |
| 45 | + "8" => "८", |
| 46 | + "9" => "९" |
| 47 | + ); |
| 48 | + } |
47 | 49 | |
48 | 50 | function getNamespaces() { |
49 | 51 | global $wgNamespaceNamesHi; |
— | — | @@ -57,14 +59,6 @@ |
58 | 60 | return parent::getMessage($key); |
59 | 61 | } |
60 | 62 | |
61 | | - function formatNum( $number ) { |
62 | | - global $wgTranslateNumerals; |
63 | | - if( $wgTranslateNumerals ) { |
64 | | - return strtr( $number, $this->digitTransTable ); |
65 | | - } else { |
66 | | - return $number; |
67 | | - } |
68 | | - } |
69 | 63 | function timeanddate( $ts, $adj = false ) { |
70 | 64 | return $this->formatNum( Language::timeanddate( $ts, $adj ) ); |
71 | 65 | } |
Index: trunk/phase3/languages/LanguagePa.php |
— | — | @@ -73,26 +73,20 @@ |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | | - var $digitTransTable = array( |
78 | | - '0' => '੦', |
79 | | - '1' => '੧', |
80 | | - '2' => '੨', |
81 | | - '3' => '੩', |
82 | | - '4' => '੪', |
83 | | - '5' => '੫', |
84 | | - '6' => '੬', |
85 | | - '7' => '੭', |
86 | | - '8' => '੮', |
87 | | - '9' => '੯' |
88 | | - ); |
89 | | - |
90 | | - function formatNum( $number ) { |
91 | | - global $wgTranslateNumerals; |
92 | | - if( $wgTranslateNumerals ) { |
93 | | - return strtr( $number, $this->digitTransTable ); |
94 | | - } else { |
95 | | - return $number; |
96 | | - } |
| 77 | + function digitTransformTable() { |
| 78 | + return array( |
| 79 | + '0' => '੦', |
| 80 | + '1' => '੧', |
| 81 | + '2' => '੨', |
| 82 | + '3' => '੩', |
| 83 | + '4' => '੪', |
| 84 | + '5' => '੫', |
| 85 | + '6' => '੬', |
| 86 | + '7' => '੭', |
| 87 | + '8' => '੮', |
| 88 | + '9' => '੯' |
| 89 | + ); |
97 | 90 | } |
| 91 | + |
98 | 92 | } |
99 | 93 | ?> |
Index: trunk/phase3/languages/LanguageHu.php |
— | — | @@ -123,8 +123,8 @@ |
124 | 124 | return $this->date( $ts, $adj ) . ", " . $this->time( $ts, $adj ); |
125 | 125 | } |
126 | 126 | |
127 | | - function formatNum( $number, $year = false ) { |
128 | | - return !$year ? strtr($this->commafy($number), array( '.' => ',', ',' => "\xc2\xa0" )) : $number; |
| 127 | + function separatorTransformTable() { |
| 128 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
129 | 129 | } |
130 | 130 | |
131 | 131 | } |
Index: trunk/phase3/languages/LanguageDz.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageDz extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '༠', |
16 | | - '1' => '༡', |
17 | | - '2' => '༢', |
18 | | - '3' => '༣', |
19 | | - '4' => '༤', |
20 | | - '5' => '༥', |
21 | | - '6' => '༦', |
22 | | - '7' => '༧', |
23 | | - '8' => '༨', |
24 | | - '9' => '༩' |
25 | | - ); |
26 | | - |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 14 | + function digitTransformTable() { |
| 15 | + return array( |
| 16 | + '0' => '༠', |
| 17 | + '1' => '༡', |
| 18 | + '2' => '༢', |
| 19 | + '3' => '༣', |
| 20 | + '4' => '༤', |
| 21 | + '5' => '༥', |
| 22 | + '6' => '༦', |
| 23 | + '7' => '༧', |
| 24 | + '8' => '༨', |
| 25 | + '9' => '༩' |
| 26 | + ); |
34 | 27 | } |
| 28 | + |
35 | 29 | } |
36 | 30 | |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguageLt.php |
— | — | @@ -81,8 +81,8 @@ |
82 | 82 | return $wgAllMessagesLt; |
83 | 83 | } |
84 | 84 | |
85 | | - function formatNum( $number, $year = false ) { |
86 | | - return $year ? $number : strtr($this->commafy($number), '.,', ', ' ); |
| 85 | + function separatorTransformTable() { |
| 86 | + return array(',' => ' ', '.' => ',' ); |
87 | 87 | } |
88 | 88 | |
89 | 89 | } |
Index: trunk/phase3/languages/LanguageTr.php |
— | — | @@ -44,10 +44,6 @@ |
45 | 45 | return $wgNamespaceNamesTr; |
46 | 46 | } |
47 | 47 | |
48 | | - function formatNum( $number, $year = false ) { |
49 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
50 | | - } |
51 | | - |
52 | 48 | function ucfirst ( $string ) { |
53 | 49 | if ( $string[0] == 'i' ) { |
54 | 50 | return 'İ' . substr( $string, 1 ); |
— | — | @@ -70,7 +66,9 @@ |
71 | 67 | return $wgDateFormatsTr; |
72 | 68 | } |
73 | 69 | |
74 | | -} |
| 70 | + function separatorTransformTable() { |
| 71 | + return array(',' => '.', '.' => ',' ); |
| 72 | + } |
75 | 73 | |
76 | | - |
77 | | -?> |
| 74 | +} |
| 75 | +?> |
\ No newline at end of file |
Index: trunk/phase3/languages/LanguageAf.php |
— | — | @@ -69,18 +69,11 @@ |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | | - function formatNum( $number, $year = false ) { |
74 | | - # South Africa uses space for thousands and comma for decimal |
75 | | - # Reference: AWS Reël 7.4 p. 52, 2002 edition |
76 | | - # glibc is wrong in this respect in some versions |
77 | | - if ( $year ) { |
78 | | - return $number; |
79 | | - } else { |
80 | | - return strtr($this->commafy($number), array( |
81 | | - '.' => ',', |
82 | | - ',' => "\xc2\xa0" // non-breaking space |
83 | | - )); |
84 | | - } |
| 73 | + # South Africa uses space for thousands and comma for decimal |
| 74 | + # Reference: AWS Reël 7.4 p. 52, 2002 edition |
| 75 | + # glibc is wrong in this respect in some versions |
| 76 | + function separatorTransformTable() { |
| 77 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
85 | 78 | } |
86 | 79 | |
87 | 80 | } |
Index: trunk/phase3/languages/LanguageSr_ec.php |
— | — | @@ -162,8 +162,8 @@ |
163 | 163 | return $wgMagicWordsSr_ec; |
164 | 164 | } |
165 | 165 | |
166 | | - function formatNum( $number, $year = false ) { |
167 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 166 | + function separatorTransformTable() { |
| 167 | + return array(',' => '.', '.' => ',' ); |
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
— | — | @@ -278,5 +278,4 @@ |
279 | 279 | } |
280 | 280 | |
281 | 281 | } |
282 | | - |
283 | 282 | ?> |
Index: trunk/phase3/languages/LanguageId.php |
— | — | @@ -113,8 +113,8 @@ |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | | - function formatNum( $number, $year = false ) { |
118 | | - return !$year ? strtr($this->commafy($number), '.,', ',.' ) : $number; |
| 117 | + function separatorTransformTable() { |
| 118 | + return array(',' => '.', '.' => ',' ); |
119 | 119 | } |
120 | 120 | |
121 | 121 | } |
Index: trunk/phase3/languages/LanguageAr.php |
— | — | @@ -97,20 +97,22 @@ |
98 | 98 | } |
99 | 99 | |
100 | 100 | class LanguageAr extends LanguageUtf8 { |
101 | | - var $digitTransTable = array( |
102 | | - '0' => '٠', |
103 | | - '1' => '١', |
104 | | - '2' => '٢', |
105 | | - '3' => '٣', |
106 | | - '4' => '٤', |
107 | | - '5' => '٥', |
108 | | - '6' => '٦', |
109 | | - '7' => '٧', |
110 | | - '8' => '٨', |
111 | | - '9' => '٩', |
112 | | - '.' => '٫', |
113 | | - ',' => '٬' |
114 | | - ); |
| 101 | + function digitTransformTable() { |
| 102 | + return array( |
| 103 | + '0' => '٠', |
| 104 | + '1' => '١', |
| 105 | + '2' => '٢', |
| 106 | + '3' => '٣', |
| 107 | + '4' => '٤', |
| 108 | + '5' => '٥', |
| 109 | + '6' => '٦', |
| 110 | + '7' => '٧', |
| 111 | + '8' => '٨', |
| 112 | + '9' => '٩', |
| 113 | + '.' => '٫', // wrong table? |
| 114 | + ',' => '٬' |
| 115 | + ); |
| 116 | + } |
115 | 117 | |
116 | 118 | function getNamespaces() { |
117 | 119 | global $wgNamespaceNamesAr; |
— | — | @@ -159,14 +161,5 @@ |
160 | 162 | } |
161 | 163 | } |
162 | 164 | |
163 | | - function formatNum( $number ) { |
164 | | - global $wgTranslateNumerals; |
165 | | - if( $wgTranslateNumerals ) { |
166 | | - return strtr( $number, $this->digitTransTable ); |
167 | | - } else { |
168 | | - return $number; |
169 | | - } |
170 | | - } |
171 | 165 | } |
172 | | - |
173 | 166 | ?> |
Index: trunk/phase3/languages/LanguageEo.php |
— | — | @@ -178,9 +178,10 @@ |
179 | 179 | $wgEditEncoding = ''; |
180 | 180 | } |
181 | 181 | |
182 | | - function formatNum( $number, $year = false ) { |
183 | | - return $year ? $number : strtr($this->commafy($number), '.,', ', ' ); |
| 182 | + function separatorTransformTable() { |
| 183 | + return array(',' => ' ', '.' => ',' ); |
184 | 184 | } |
| 185 | + |
185 | 186 | } |
186 | 187 | |
187 | 188 | ?> |
Index: trunk/phase3/languages/LanguageEs.php |
— | — | @@ -80,9 +80,10 @@ |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | | - function formatNum( $number, $year = false ) { |
85 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 84 | + function separatorTransformTable() { |
| 85 | + return array(',' => '.', '.' => ',' ); |
86 | 86 | } |
| 87 | + |
87 | 88 | } |
88 | 89 | |
89 | 90 | ?> |
Index: trunk/phase3/languages/LanguageAz.php |
— | — | @@ -43,15 +43,14 @@ |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | | - |
48 | 47 | class LanguageAz extends LanguageUtf8 { |
49 | 48 | function getNamespaces() { |
50 | 49 | global $wgNamespaceNamesAz; |
51 | 50 | return $wgNamespaceNamesAz; |
52 | 51 | } |
53 | 52 | |
54 | | - function formatNum( $number, $year = false ) { |
55 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 53 | + function separatorTransformTable() { |
| 54 | + return array(',' => '.', '.' => ',' ); |
56 | 55 | } |
57 | 56 | |
58 | 57 | function ucfirst ( $string ) { |
— | — | @@ -77,6 +76,4 @@ |
78 | 77 | } |
79 | 78 | |
80 | 79 | } |
81 | | - |
82 | | - |
83 | 80 | ?> |
\ No newline at end of file |
Index: trunk/phase3/languages/LanguageIt.php |
— | — | @@ -63,8 +63,8 @@ |
64 | 64 | /** |
65 | 65 | * Italian numeric format is 201.511,17 |
66 | 66 | */ |
67 | | - function formatNum( $number, $year = false ) { |
68 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 67 | + function separatorTransformTable() { |
| 68 | + return array(',' => '.', '.' => ',' ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | } |
Index: trunk/phase3/languages/LanguageUk.php |
— | — | @@ -90,10 +90,9 @@ |
91 | 91 | return "windows-1251"; |
92 | 92 | } |
93 | 93 | |
94 | | - function formatNum( $number, $year = false ) { |
95 | | - return !$year ? strtr($number, '.,', ',.' ) : $number; |
| 94 | + function separatorTransformTable() { |
| 95 | + return array(',' => '.', '.' => ',' ); |
96 | 96 | } |
97 | 97 | |
98 | 98 | } |
99 | | - |
100 | | -?> |
| 99 | +?> |
\ No newline at end of file |
Index: trunk/phase3/languages/LanguageBe.php |
— | — | @@ -169,8 +169,8 @@ |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | | - function formatNum( $number, $year = false ) { |
174 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 173 | + function separatorTransformTable() { |
| 174 | + return array(',' => '.', '.' => ',' ); |
175 | 175 | } |
176 | 176 | |
177 | 177 | function convertPlural( $count, $wordform1, $wordform2, $wordform3) { |
— | — | @@ -188,4 +188,5 @@ |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
| 192 | + |
192 | 193 | ?> |
Index: trunk/phase3/languages/LanguageBg.php |
— | — | @@ -173,26 +173,21 @@ |
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | | - /** |
178 | | - * Translation table for numbers |
179 | | - * @var array |
180 | | - */ |
181 | | - var $digitTransTable = array( |
182 | | - ',' => "\xC2\xA0", // @bug 2749 |
183 | | - '.' => ',' |
184 | | - ); |
| 177 | + function separatorTransformTable() { |
| 178 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
| 179 | + } |
185 | 180 | |
186 | 181 | /** |
187 | 182 | * ISO number formatting: 123 456 789,99. |
188 | 183 | * Avoid tripple grouping by numbers with whole part up to 4 digits. |
189 | | - * @param string $number |
190 | | - * @return string |
191 | 184 | */ |
192 | | - function formatNum( $number, $year = false ) { |
193 | | - if ( preg_match('/^\d{5}/', $number) ) { |
194 | | - $number = $this->commafy($number); |
| 185 | + function commafy($_) { |
| 186 | + if (!preg_match('/^\d{1,4}$/',$_)) { |
| 187 | + return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_))); |
| 188 | + } else { |
| 189 | + return $_; |
195 | 190 | } |
196 | | - return strtr($number, $this->digitTransTable); |
197 | 191 | } |
| 192 | + |
198 | 193 | } |
199 | 194 | ?> |
Index: trunk/phase3/languages/LanguageBo.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageBo extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '༠', |
16 | | - '1' => '༡', |
17 | | - '2' => '༢', |
18 | | - '3' => '༣', |
19 | | - '4' => '༤', |
20 | | - '5' => '༥', |
21 | | - '6' => '༦', |
22 | | - '7' => '༧', |
23 | | - '8' => '༨', |
24 | | - '9' => '༩' |
25 | | - ); |
26 | | - |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 14 | + function digitTransformTable() { |
| 15 | + return array( |
| 16 | + '0' => '༠', |
| 17 | + '1' => '༡', |
| 18 | + '2' => '༢', |
| 19 | + '3' => '༣', |
| 20 | + '4' => '༤', |
| 21 | + '5' => '༥', |
| 22 | + '6' => '༦', |
| 23 | + '7' => '༧', |
| 24 | + '8' => '༨', |
| 25 | + '9' => '༩' |
| 26 | + ); |
34 | 27 | } |
| 28 | + |
35 | 29 | } |
36 | 30 | |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguageBs.php |
— | — | @@ -160,8 +160,8 @@ |
161 | 161 | return "iso-8859-2"; |
162 | 162 | } |
163 | 163 | |
164 | | - function formatNum( $number, $year = false ) { |
165 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 164 | + function separatorTransformTable() { |
| 165 | + return array(',' => '.', '.' => ',' ); |
166 | 166 | } |
167 | 167 | |
168 | 168 | # Convert from the nominative form of a noun to some other case |
Index: trunk/phase3/languages/LanguageFr.php |
— | — | @@ -92,13 +92,8 @@ |
93 | 93 | return " à "; |
94 | 94 | } |
95 | 95 | |
96 | | - var $digitTransTable = array( |
97 | | - ',' => "\xc2\xa0", // @bug 2749 |
98 | | - '.' => ',' |
99 | | - ); |
100 | | - |
101 | | - function formatNum( $number, $year = false ) { |
102 | | - return !$year ? strtr($number, $this->digitTransTable ) : $number; |
| 96 | + function separatorTransformTable() { |
| 97 | + return array(',' => "\xc2\xa0", '.' => ',' ); |
103 | 98 | } |
104 | 99 | |
105 | 100 | function getMessage( $key ) { |
Index: trunk/phase3/languages/LanguageNl.php |
— | — | @@ -83,9 +83,9 @@ |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | | - function formatNum( $number, $year = false ) { |
88 | | - return $year ? $number : strtr( $this->commafy( $number ), '.,', ',.' ); |
| 87 | + function separatorTransformTable() { |
| 88 | + return array(',' => '.', '.' => ',' ); |
89 | 89 | } |
| 90 | + |
90 | 91 | } |
91 | | - |
92 | 92 | ?> |
Index: trunk/phase3/languages/LanguageNn.php |
— | — | @@ -204,13 +204,11 @@ |
205 | 205 | |
206 | 206 | } |
207 | 207 | |
208 | | - var $digitTransTable = array( |
209 | | - ',' => "\xc2\xa0", |
210 | | - '.' => ',' |
211 | | - ); |
212 | | - |
213 | | - function formatNum( $number, $year = false ) { |
214 | | - return $year ? $number : strtr($this->commafy($number), $this->digitTransTable); |
| 208 | + function separatorTransformTable() { |
| 209 | + return array( |
| 210 | + ',' => "\xc2\xa0", |
| 211 | + '.' => ',' |
| 212 | + ); |
215 | 213 | } |
216 | 214 | |
217 | 215 | function getMessage( $key ) { |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -892,10 +892,7 @@ |
893 | 893 | return "<em>$text</em>"; |
894 | 894 | } |
895 | 895 | |
896 | | - /** |
897 | | - * This function enables formatting of numbers, it should only come |
898 | | - * into effect when the $wgTranslateNumerals variable is TRUE. |
899 | | - * |
| 896 | + /** |
900 | 897 | * Normally we output all numbers in plain en_US style, that is |
901 | 898 | * 293,291.235 for twohundredninetythreethousand-twohundredninetyone |
902 | 899 | * point twohundredthirtyfive. However this is not sutable for all |
— | — | @@ -916,11 +913,23 @@ |
917 | 914 | * @public |
918 | 915 | * @param mixed $number the string to be formatted, should be an integer or |
919 | 916 | * a floating point number. |
920 | | - * @param bool $year are we being passed a year? (turns off commafication) |
921 | | - * @return mixed whatever we're fed if it's a year, a string otherwise. |
| 917 | + * @param bool $commafy Set to false for special numbers like dates |
| 918 | + * @return string |
922 | 919 | */ |
923 | | - function formatNum( $number, $year = false ) { |
924 | | - return $year ? $number : $this->commafy($number); |
| 920 | + function formatNum( $number, $commafy = false ) { |
| 921 | + global $wgTranslateNumerals; |
| 922 | + if (!$commafy) { |
| 923 | + $number = $this->commafy($number); |
| 924 | + $s = $this->separatorTransformTable(); |
| 925 | + if (!is_null($s)) { $number = strtr($number, $s); } |
| 926 | + } |
| 927 | + |
| 928 | + if ($wgTranslateNumerals) { |
| 929 | + $s = $this->digitTransformTable(); |
| 930 | + if (!is_null($s)) { $number = strtr($number, $s); } |
| 931 | + } |
| 932 | + |
| 933 | + return $number; |
925 | 934 | } |
926 | 935 | |
927 | 936 | /** |
— | — | @@ -933,6 +942,15 @@ |
934 | 943 | return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_))); |
935 | 944 | } |
936 | 945 | |
| 946 | + function digitTransformTable() { |
| 947 | + return null; |
| 948 | + } |
| 949 | + |
| 950 | + function separatorTransformTable() { |
| 951 | + return null; |
| 952 | + } |
| 953 | + |
| 954 | + |
937 | 955 | /** |
938 | 956 | * For the credit list in includes/Credits.php (action=credits) |
939 | 957 | * |
Index: trunk/phase3/languages/LanguageRu.php |
— | — | @@ -217,22 +217,24 @@ |
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | | - /** |
| 221 | + /* |
222 | 222 | * Russian numeric format is "12 345,67" but "1234,56" |
223 | 223 | */ |
224 | | - function formatNum( $number, $year = false ) { |
225 | | - if ($year) { |
226 | | - return $number; |
| 224 | + |
| 225 | + function commafy($_) { |
| 226 | + if (!preg_match('/^\d{1,4}$/',$_)) { |
| 227 | + return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_))); |
| 228 | + } else { |
| 229 | + return $_; |
227 | 230 | } |
228 | | - else { |
229 | | - //not strtr because of 2-byte unicode nbsp char |
230 | | - $commafied_number = str_replace('.', ',', str_replace(',', ' ', $this->commafy($number))); |
231 | | - return ($number<10000) ? str_replace(' ', '', $commafied_number) : $commafied_number; |
232 | | - } |
| 231 | + } |
233 | 232 | |
234 | | - |
| 233 | + function separatorTransformTable() { |
| 234 | + return array( |
| 235 | + ',' => "\xc2\xa0", |
| 236 | + '.' => ',' |
| 237 | + ); |
235 | 238 | } |
236 | 239 | |
237 | 240 | } |
238 | | - |
239 | 241 | ?> |
Index: trunk/phase3/languages/LanguageKn.php |
— | — | @@ -21,18 +21,20 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | class LanguageKn extends LanguageUtf8 { |
25 | | - var $digitTransTable = array( |
26 | | - '0' => '೦', |
27 | | - '1' => '೧', |
28 | | - '2' => '೨', |
29 | | - '3' => '೩', |
30 | | - '4' => '೪', |
31 | | - '5' => '೫', |
32 | | - '6' => '೬', |
33 | | - '7' => '೭', |
34 | | - '8' => '೮', |
35 | | - '9' => '೯' |
36 | | - ); |
| 25 | + function digitTransformTable() { |
| 26 | + return array( |
| 27 | + '0' => '೦', |
| 28 | + '1' => '೧', |
| 29 | + '2' => '೨', |
| 30 | + '3' => '೩', |
| 31 | + '4' => '೪', |
| 32 | + '5' => '೫', |
| 33 | + '6' => '೬', |
| 34 | + '7' => '೭', |
| 35 | + '8' => '೮', |
| 36 | + '9' => '೯' |
| 37 | + ); |
| 38 | + } |
37 | 39 | |
38 | 40 | function getMessage( $key ) { |
39 | 41 | global $wgAllMessagesKn; |
— | — | @@ -42,14 +44,6 @@ |
43 | 45 | return parent::getMessage($key); |
44 | 46 | } |
45 | 47 | |
46 | | - function formatNum( $number ) { |
47 | | - global $wgTranslateNumerals; |
48 | | - if( $wgTranslateNumerals ) { |
49 | | - return strtr( $number, $this->digitTransTable ); |
50 | | - } else { |
51 | | - return $number; |
52 | | - } |
53 | | - } |
54 | 48 | } |
55 | 49 | |
56 | 50 | ?> |
Index: trunk/phase3/languages/LanguageGu.php |
— | — | @@ -7,27 +7,21 @@ |
8 | 8 | require_once( 'LanguageUtf8.php' ); |
9 | 9 | |
10 | 10 | class LanguageGu extends LanguageUtf8 { |
11 | | - var $digitTransTable = array( |
12 | | - '0' => '૦', |
13 | | - '1' => '૧', |
14 | | - '2' => '૨', |
15 | | - '3' => '૩', |
16 | | - '4' => '૪', |
17 | | - '5' => '૫', |
18 | | - '6' => '૬', |
19 | | - '7' => '૭', |
20 | | - '8' => '૮', |
21 | | - '9' => '૯' |
22 | | - ); |
23 | | - |
24 | | - function formatNum( $number ) { |
25 | | - global $wgTranslateNumerals; |
26 | | - if( $wgTranslateNumerals ) { |
27 | | - return strtr( $number, $this->digitTransTable ); |
28 | | - } else { |
29 | | - return $number; |
30 | | - } |
| 11 | + function digitTransformTable() { |
| 12 | + return array( |
| 13 | + '0' => '૦', |
| 14 | + '1' => '૧', |
| 15 | + '2' => '૨', |
| 16 | + '3' => '૩', |
| 17 | + '4' => '૪', |
| 18 | + '5' => '૫', |
| 19 | + '6' => '૬', |
| 20 | + '7' => '૭', |
| 21 | + '8' => '૮', |
| 22 | + '9' => '૯' |
| 23 | + ); |
31 | 24 | } |
| 25 | + |
32 | 26 | } |
33 | 27 | |
34 | 28 | ?> |
Index: trunk/phase3/languages/LanguageSl.php |
— | — | @@ -93,8 +93,8 @@ |
94 | 94 | return "iso-8859-2"; |
95 | 95 | } |
96 | 96 | |
97 | | - function formatNum( $number, $year = false ) { |
98 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 97 | + function separatorTransformTable() { |
| 98 | + return array(',' => '.', '.' => ',' ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | # Convert from the nominative form of a noun to some other case |
Index: trunk/phase3/languages/LanguageOs.php |
— | — | @@ -83,9 +83,5 @@ |
84 | 84 | return "windows-1251"; |
85 | 85 | } |
86 | 86 | |
87 | | - function formatNum( $number, $year = false ) { |
88 | | - return !$year ? strtr($number, '.,', ', ' ) : $number; |
89 | | - } |
90 | | - |
91 | 87 | } |
92 | 88 | ?> |
Index: trunk/phase3/languages/LanguageDa.php |
— | — | @@ -102,8 +102,8 @@ |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | | - function formatNum( $number, $year = false ) { |
107 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 106 | + function separatorTransformTable() { |
| 107 | + return array(',' => '.', '.' => ',' ); |
108 | 108 | } |
109 | 109 | |
110 | 110 | } |
Index: trunk/phase3/languages/LanguageDe.php |
— | — | @@ -100,8 +100,8 @@ |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | | - function formatNum( $number, $year = false ) { |
105 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
| 104 | + function separatorTransformTable() { |
| 105 | + return array(',' => '.', '.' => ',' ); |
106 | 106 | } |
107 | 107 | |
108 | 108 | } |
Index: trunk/phase3/languages/LanguageSv.php |
— | — | @@ -93,14 +93,12 @@ |
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | | - var $digitTransTable = array( |
98 | | - ',' => "\xc2\xa0", // @bug 2749 |
99 | | - '.' => ',' |
100 | | - ); |
101 | | - |
102 | | - function formatNum( $number, $year = false ) { |
103 | | - return $year ? $number : strtr($this->commafy($number), $this->digitTransTable); |
| 97 | + function separatorTransformTable() { |
| 98 | + return array( |
| 99 | + ',' => "\xc2\xa0", // @bug 2749 |
| 100 | + '.' => ',' |
| 101 | + ); |
104 | 102 | } |
105 | | -} |
106 | 103 | |
| 104 | +} |
107 | 105 | ?> |
Index: trunk/phase3/languages/LanguageTe.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageTe extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '౦', |
16 | | - '1' => '౧', |
17 | | - '2' => '౨', |
18 | | - '3' => '౩', |
19 | | - '4' => '౪', |
20 | | - '5' => '౫', |
21 | | - '6' => '౬', |
22 | | - '7' => '౭', |
23 | | - '8' => '౮', |
24 | | - '9' => '౯' |
25 | | - ); |
26 | 14 | |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 15 | + function digitTransformTable() { |
| 16 | + return array( |
| 17 | + '0' => '౦', |
| 18 | + '1' => '౧', |
| 19 | + '2' => '౨', |
| 20 | + '3' => '౩', |
| 21 | + '4' => '౪', |
| 22 | + '5' => '౫', |
| 23 | + '6' => '౬', |
| 24 | + '7' => '౭', |
| 25 | + '8' => '౮', |
| 26 | + '9' => '౯' |
| 27 | + ); |
34 | 28 | } |
35 | | -} |
36 | 29 | |
| 30 | +} |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguageHr.php |
— | — | @@ -94,9 +94,9 @@ |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | | - function formatNum( $number, $year = false ) { |
99 | | - return $year ? $number : strtr($this->commafy($number), '.,', ',.' ); |
100 | | - } |
| 98 | + function separatorTransformTable() { |
| 99 | + return array(',' => '.', '.' => ',' ); |
| 100 | + } |
101 | 101 | |
102 | 102 | function fallback8bitEncoding() { |
103 | 103 | return "iso-8859-2"; |
Index: trunk/phase3/languages/LanguageLo.php |
— | — | @@ -10,27 +10,21 @@ |
11 | 11 | require_once( 'LanguageUtf8.php' ); |
12 | 12 | |
13 | 13 | class LanguageLo extends LanguageUtf8 { |
14 | | - var $digitTransTable = array( |
15 | | - '0' => '໐', |
16 | | - '1' => '໑', |
17 | | - '2' => '໒', |
18 | | - '3' => '໓', |
19 | | - '4' => '໔', |
20 | | - '5' => '໕', |
21 | | - '6' => '໖', |
22 | | - '7' => '໗', |
23 | | - '8' => '໘', |
24 | | - '9' => '໙' |
25 | | - ); |
26 | | - |
27 | | - function formatNum( $number ) { |
28 | | - global $wgTranslateNumerals; |
29 | | - if( $wgTranslateNumerals ) { |
30 | | - return strtr( $number, $this->digitTransTable ); |
31 | | - } else { |
32 | | - return $number; |
33 | | - } |
| 14 | + function digitTransformTable() { |
| 15 | + return array( |
| 16 | + '0' => '໐', |
| 17 | + '1' => '໑', |
| 18 | + '2' => '໒', |
| 19 | + '3' => '໓', |
| 20 | + '4' => '໔', |
| 21 | + '5' => '໕', |
| 22 | + '6' => '໖', |
| 23 | + '7' => '໗', |
| 24 | + '8' => '໘', |
| 25 | + '9' => '໙' |
| 26 | + ); |
34 | 27 | } |
| 28 | + |
35 | 29 | } |
36 | 30 | |
37 | 31 | ?> |
Index: trunk/phase3/languages/LanguagePl.php |
— | — | @@ -104,14 +104,12 @@ |
105 | 105 | return "iso-8859-2"; |
106 | 106 | } |
107 | 107 | |
108 | | - var $digitTransTable = array( |
109 | | - ',' => "\xc2\xa0", // @bug 2749 |
110 | | - '.' => ',' |
111 | | - ); |
112 | | - |
113 | | - function formatNum( $number, $year = false ) { |
114 | | - return !$year ? strtr($number, $this->digitTransTable ) : $number; |
| 108 | + function separatorTransformTable() { |
| 109 | + return array( |
| 110 | + ',' => "\xc2\xa0", // @bug 2749 |
| 111 | + '.' => ',' |
| 112 | + ); |
115 | 113 | } |
116 | | -} |
117 | 114 | |
| 115 | +} |
118 | 116 | ?> |
Index: trunk/phase3/languages/LanguagePt.php |
— | — | @@ -141,8 +141,8 @@ |
142 | 142 | /** |
143 | 143 | * Portuguese numeric format is 123 456,78 |
144 | 144 | */ |
145 | | - function formatNum( $number, $year = false ) { |
146 | | - return $year ? $number : strtr($this->commafy($number), '.,', ', ' ); |
| 145 | + function separatorTransformTable() { |
| 146 | + return array(',' => ' ', '.' => ',' ); |
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |