Skip to content

Commit 8c17354

Browse files
author
chinasqzl
authored
Add chinese abbreviations for area,length,mass units (#867)
1 parent 25b6558 commit 8c17354

File tree

6 files changed

+227
-26
lines changed

6 files changed

+227
-26
lines changed

CodeGen/PrefixInfo.cs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using CodeGen.JsonTypes;
@@ -11,33 +11,34 @@ namespace CodeGen
1111
internal class PrefixInfo
1212
{
1313
private const string Russian = "ru-RU";
14+
private const string Chinese = "zh-CN";
1415

1516
public static readonly IReadOnlyDictionary<Prefix, PrefixInfo> Entries = new[]
1617
{
1718
// Need to append 'd' suffix for double in order to later search/replace "d" with "m"
1819
// when creating decimal conversion functions in CodeGen.Generator.FixConversionFunctionsForDecimalValueTypes.
1920

2021
// SI prefixes
21-
new PrefixInfo(Prefix.Yocto, "1e-24d", "y"),
22-
new PrefixInfo(Prefix.Zepto, "1e-21d", "z"),
23-
new PrefixInfo(Prefix.Atto, "1e-18d", "a", (Russian, "а")),
24-
new PrefixInfo(Prefix.Femto, "1e-15d", "f", (Russian, "ф")),
25-
new PrefixInfo(Prefix.Pico, "1e-12d", "p", (Russian, "п")),
26-
new PrefixInfo(Prefix.Nano, "1e-9d", "n", (Russian, "н")),
27-
new PrefixInfo(Prefix.Micro, "1e-6d", "µ", (Russian, "мк")),
28-
new PrefixInfo(Prefix.Milli, "1e-3d", "m", (Russian, "м")),
29-
new PrefixInfo(Prefix.Centi, "1e-2d", "c", (Russian, "с")),
30-
new PrefixInfo(Prefix.Deci, "1e-1d", "d", (Russian, "д")),
31-
new PrefixInfo(Prefix.Deca, "1e1d", "da", (Russian, "да")),
32-
new PrefixInfo(Prefix.Hecto, "1e2d", "h", (Russian, "г")),
33-
new PrefixInfo(Prefix.Kilo, "1e3d", "k", (Russian, "к")),
34-
new PrefixInfo(Prefix.Mega, "1e6d", "M", (Russian, "М")),
35-
new PrefixInfo(Prefix.Giga, "1e9d", "G", (Russian, "Г")),
36-
new PrefixInfo(Prefix.Tera, "1e12d", "T", (Russian, "Т")),
37-
new PrefixInfo(Prefix.Peta, "1e15d", "P", (Russian, "П")),
38-
new PrefixInfo(Prefix.Exa, "1e18d", "E", (Russian, "Э")),
39-
new PrefixInfo(Prefix.Zetta, "1e21d", "Z"),
40-
new PrefixInfo(Prefix.Yotta, "1e24d", "Y"),
22+
new PrefixInfo(Prefix.Yocto, "1e-24d", "y",(Chinese, "夭")),
23+
new PrefixInfo(Prefix.Zepto, "1e-21d", "z",(Chinese, "仄")),
24+
new PrefixInfo(Prefix.Atto, "1e-18d", "a", (Russian, "а"),(Chinese, "阿")),
25+
new PrefixInfo(Prefix.Femto, "1e-15d", "f", (Russian, "ф"),(Chinese, "飞")),
26+
new PrefixInfo(Prefix.Pico, "1e-12d", "p", (Russian, "п"),(Chinese, "皮")),
27+
new PrefixInfo(Prefix.Nano, "1e-9d", "n", (Russian, "н"),(Chinese, "纳")),
28+
new PrefixInfo(Prefix.Micro, "1e-6d", "µ", (Russian, "мк"),(Chinese, "微")),
29+
new PrefixInfo(Prefix.Milli, "1e-3d", "m", (Russian, "м"),(Chinese, "毫")),
30+
new PrefixInfo(Prefix.Centi, "1e-2d", "c", (Russian, "с"),(Chinese, "厘")),
31+
new PrefixInfo(Prefix.Deci, "1e-1d", "d", (Russian, "д"),(Chinese, "分")),
32+
new PrefixInfo(Prefix.Deca, "1e1d", "da", (Russian, "да"),(Chinese, "十")),
33+
new PrefixInfo(Prefix.Hecto, "1e2d", "h", (Russian, "г"),(Chinese, "百")),
34+
new PrefixInfo(Prefix.Kilo, "1e3d", "k", (Russian, "к"),(Chinese, "千")),
35+
new PrefixInfo(Prefix.Mega, "1e6d", "M", (Russian, "М"),(Chinese, "兆")),
36+
new PrefixInfo(Prefix.Giga, "1e9d", "G", (Russian, "Г"),(Chinese, "吉")),
37+
new PrefixInfo(Prefix.Tera, "1e12d", "T", (Russian, "Т"),(Chinese, "太")),
38+
new PrefixInfo(Prefix.Peta, "1e15d", "P", (Russian, "П"),(Chinese, "拍")),
39+
new PrefixInfo(Prefix.Exa, "1e18d", "E", (Russian, "Э"),(Chinese, "艾")),
40+
new PrefixInfo(Prefix.Zetta, "1e21d", "Z",(Chinese, "泽")),
41+
new PrefixInfo(Prefix.Yotta, "1e24d", "Y",(Chinese, "尧")),
4142

4243
// Binary prefixes
4344
new PrefixInfo(Prefix.Kibi, "1024d", "Ki"),

Common/UnitDefinitions/Area.json

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
{
2323
"Culture": "ru-RU",
2424
"Abbreviations": [ "км²" ]
25+
},
26+
{
27+
"Culture": "zh-CN",
28+
"Abbreviations": [ "平方公里" ]
2529
}
2630
]
2731
},
@@ -41,6 +45,10 @@
4145
{
4246
"Culture": "ru-RU",
4347
"Abbreviations": [ "м²" ]
48+
},
49+
{
50+
"Culture": "zh-CN",
51+
"Abbreviations": [ "平方米" ]
4452
}
4553
]
4654
},
@@ -60,6 +68,10 @@
6068
{
6169
"Culture": "ru-RU",
6270
"Abbreviations": [ "дм²" ]
71+
},
72+
{
73+
"Culture": "zh-CN",
74+
"Abbreviations": [ "平方分米" ]
6375
}
6476
]
6577
},
@@ -79,6 +91,10 @@
7991
{
8092
"Culture": "ru-RU",
8193
"Abbreviations": [ "см²" ]
94+
},
95+
{
96+
"Culture": "zh-CN",
97+
"Abbreviations": [ "平方厘米" ]
8298
}
8399
]
84100
},
@@ -98,6 +114,10 @@
98114
{
99115
"Culture": "ru-RU",
100116
"Abbreviations": [ "мм²" ]
117+
},
118+
{
119+
"Culture": "zh-CN",
120+
"Abbreviations": [ "平方毫米" ]
101121
}
102122
]
103123
},
@@ -117,6 +137,10 @@
117137
{
118138
"Culture": "ru-RU",
119139
"Abbreviations": [ "мкм²" ]
140+
},
141+
{
142+
"Culture": "zh-CN",
143+
"Abbreviations": [ "平方微米" ]
120144
}
121145
]
122146
},
@@ -136,6 +160,10 @@
136160
{
137161
"Culture": "ru-RU",
138162
"Abbreviations": [ "миля²" ]
163+
},
164+
{
165+
"Culture": "zh-CN",
166+
"Abbreviations": [ "平方英里" ]
139167
}
140168
]
141169
},
@@ -155,6 +183,10 @@
155183
{
156184
"Culture": "ru-RU",
157185
"Abbreviations": [ "ярд²" ]
186+
},
187+
{
188+
"Culture": "zh-CN",
189+
"Abbreviations": [ "平方码" ]
158190
}
159191
]
160192
},
@@ -174,6 +206,10 @@
174206
{
175207
"Culture": "ru-RU",
176208
"Abbreviations": [ "фут²" ]
209+
},
210+
{
211+
"Culture": "zh-CN",
212+
"Abbreviations": [ "平方英尺" ]
177213
}
178214
]
179215
},
@@ -212,6 +248,10 @@
212248
{
213249
"Culture": "ru-RU",
214250
"Abbreviations": [ "дюйм²" ]
251+
},
252+
{
253+
"Culture": "zh-CN",
254+
"Abbreviations": [ "平方英寸" ]
215255
}
216256
]
217257
},
@@ -225,9 +265,13 @@
225265
"Culture": "en-US",
226266
"Abbreviations": [ "ac" ]
227267
},
228-
{
268+
{
229269
"Culture": "ru-RU",
230270
"Abbreviations": [ "акр" ]
271+
},
272+
{
273+
"Culture": "zh-CN",
274+
"Abbreviations": [ "英亩" ]
231275
}
232276
]
233277
},
@@ -241,9 +285,13 @@
241285
"Culture": "en-US",
242286
"Abbreviations": [ "ha" ]
243287
},
244-
{
288+
{
245289
"Culture": "ru-RU",
246290
"Abbreviations": [ "га" ]
291+
},
292+
{
293+
"Culture": "zh-CN",
294+
"Abbreviations": [ "英亩" ]
247295
}
248296
]
249297
},
@@ -255,11 +303,15 @@
255303
"Localization": [
256304
{
257305
"Culture": "en-US",
258-
"Abbreviations": ["nmi²"]
306+
"Abbreviations": [ "nmi²" ]
259307
},
260-
{
308+
{
261309
"Culture": "ru-RU",
262-
"Abbreviations": ["морск.миля²"]
310+
"Abbreviations": [ "морск.миля²" ]
311+
},
312+
{
313+
"Culture": "zh-CN",
314+
"Abbreviations": [ "平方海里" ]
263315
}
264316
]
265317
}

Common/UnitDefinitions/Length.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
{
2424
"Culture": "ru-RU",
2525
"Abbreviations": [ "м" ]
26+
},
27+
{
28+
"Culture": "zh-CN",
29+
"Abbreviations": [ "" ]
2630
}
2731
]
2832
},
@@ -42,6 +46,10 @@
4246
{
4347
"Culture": "ru-RU",
4448
"Abbreviations": [ "миля" ]
49+
},
50+
{
51+
"Culture": "zh-CN",
52+
"Abbreviations": [ "英里" ]
4553
}
4654
]
4755
},
@@ -61,6 +69,10 @@
6169
{
6270
"Culture": "ru-RU",
6371
"Abbreviations": [ "ярд" ]
72+
},
73+
{
74+
"Culture": "zh-CN",
75+
"Abbreviations": [ "" ]
6476
}
6577
]
6678
},
@@ -80,6 +92,10 @@
8092
{
8193
"Culture": "ru-RU",
8294
"Abbreviations": [ "фут" ]
95+
},
96+
{
97+
"Culture": "zh-CN",
98+
"Abbreviations": [ "英尺" ]
8399
}
84100
]
85101
},
@@ -114,6 +130,10 @@
114130
{
115131
"Culture": "ru-RU",
116132
"Abbreviations": [ "дюйм" ]
133+
},
134+
{
135+
"Culture": "zh-CN",
136+
"Abbreviations": [ "英寸" ]
117137
}
118138
]
119139
},
@@ -133,6 +153,10 @@
133153
{
134154
"Culture": "ru-RU",
135155
"Abbreviations": [ "мил" ]
156+
},
157+
{
158+
"Culture": "zh-CN",
159+
"Abbreviations": [ "密耳" ]
136160
}
137161
]
138162
},
@@ -152,6 +176,10 @@
152176
{
153177
"Culture": "ru-RU",
154178
"Abbreviations": [ "мил" ]
179+
},
180+
{
181+
"Culture": "zh-CN",
182+
"Abbreviations": [ "纳米" ]
155183
}
156184
]
157185
},
@@ -201,6 +229,10 @@
201229
{
202230
"Culture": "ru-RU",
203231
"Abbreviations": [ "микродюйм" ]
232+
},
233+
{
234+
"Culture": "zh-CN",
235+
"Abbreviations": [ "微英寸" ]
204236
}
205237
]
206238
},

Common/UnitDefinitions/Mass.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
{
2424
"Culture": "ru-RU",
2525
"Abbreviations": [ "г" ]
26+
},
27+
{
28+
"Culture": "zh-CN",
29+
"Abbreviations": [ "" ]
2630
}
2731
]
2832
},
@@ -43,6 +47,10 @@
4347
{
4448
"Culture": "ru-RU",
4549
"Abbreviations": [ "т" ]
50+
},
51+
{
52+
"Culture": "zh-CN",
53+
"Abbreviations": [ "" ]
4654
}
4755
]
4856
},
@@ -64,6 +72,10 @@
6472
{
6573
"Culture": "ru-RU",
6674
"Abbreviations": [ "тонна малая" ]
75+
},
76+
{
77+
"Culture": "zh-CN",
78+
"Abbreviations": [ "短吨" ]
6779
}
6880
]
6981
},
@@ -85,6 +97,10 @@
8597
{
8698
"Culture": "ru-RU",
8799
"Abbreviations": [ "тонна большая" ]
100+
},
101+
{
102+
"Culture": "zh-CN",
103+
"Abbreviations": [ "长吨" ]
88104
}
89105
]
90106
},
@@ -106,6 +122,10 @@
106122
{
107123
"Culture": "ru-RU",
108124
"Abbreviations": [ "фунт" ]
125+
},
126+
{
127+
"Culture": "zh-CN",
128+
"Abbreviations": [ "" ]
109129
}
110130
]
111131
},
@@ -123,6 +143,10 @@
123143
{
124144
"Culture": "en-US",
125145
"Abbreviations": [ "oz" ]
146+
},
147+
{
148+
"Culture": "zh-CN",
149+
"Abbreviations": [ "盎司" ]
126150
}
127151
]
128152
},

0 commit comments

Comments
 (0)