twitter_cldr 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. data/Gemfile +3 -2
  2. data/History.txt +7 -1
  3. data/README.md +55 -0
  4. data/lib/twitter_cldr/core_ext.rb +1 -1
  5. data/lib/twitter_cldr/formatters/list_formatter.rb +64 -0
  6. data/lib/twitter_cldr/formatters.rb +4 -2
  7. data/lib/twitter_cldr/localized/localized_array.rb +19 -1
  8. data/lib/twitter_cldr/localized/localized_hash.rb +20 -0
  9. data/lib/twitter_cldr/localized/localized_string.rb +46 -1
  10. data/lib/twitter_cldr/localized/localized_symbol.rb +4 -0
  11. data/lib/twitter_cldr/localized.rb +1 -0
  12. data/lib/twitter_cldr/resources/bidi_test_importer.rb +118 -0
  13. data/lib/twitter_cldr/resources/locales_resources_importer.rb +1 -1
  14. data/lib/twitter_cldr/resources.rb +1 -0
  15. data/lib/twitter_cldr/shared/bidi.rb +526 -0
  16. data/lib/twitter_cldr/shared/languages.rb +5 -0
  17. data/lib/twitter_cldr/shared.rb +1 -0
  18. data/lib/twitter_cldr/utils/code_points.rb +1 -1
  19. data/lib/twitter_cldr/utils/yaml.rb +390 -0
  20. data/lib/twitter_cldr/utils.rb +1 -0
  21. data/lib/twitter_cldr/version.rb +1 -1
  22. data/lib/twitter_cldr.rb +2 -0
  23. data/resources/custom/locales/en/units.yml +19 -18
  24. data/resources/locales/af/calendars.yml +67 -66
  25. data/resources/locales/af/languages.yml +22 -22
  26. data/resources/locales/af/layout.yml +5 -0
  27. data/resources/locales/af/lists.yml +7 -0
  28. data/resources/locales/af/numbers.yml +36 -36
  29. data/resources/locales/af/plurals.yml +2 -3
  30. data/resources/locales/af/units.yml +75 -75
  31. data/resources/locales/ar/calendars.yml +149 -148
  32. data/resources/locales/ar/languages.yml +501 -501
  33. data/resources/locales/ar/layout.yml +5 -0
  34. data/resources/locales/ar/lists.yml +7 -0
  35. data/resources/locales/ar/numbers.yml +31 -31
  36. data/resources/locales/ar/plurals.yml +2 -9
  37. data/resources/locales/ar/units.yml +220 -220
  38. data/resources/locales/ca/calendars.yml +78 -77
  39. data/resources/locales/ca/languages.yml +199 -199
  40. data/resources/locales/ca/layout.yml +5 -0
  41. data/resources/locales/ca/lists.yml +7 -0
  42. data/resources/locales/ca/numbers.yml +36 -36
  43. data/resources/locales/ca/plurals.yml +2 -3
  44. data/resources/locales/ca/units.yml +108 -108
  45. data/resources/locales/cs/calendars.yml +141 -140
  46. data/resources/locales/cs/languages.yml +399 -399
  47. data/resources/locales/cs/layout.yml +5 -0
  48. data/resources/locales/cs/lists.yml +7 -0
  49. data/resources/locales/cs/numbers.yml +41 -41
  50. data/resources/locales/cs/plurals.yml +2 -3
  51. data/resources/locales/cs/units.yml +142 -142
  52. data/resources/locales/da/calendars.yml +73 -73
  53. data/resources/locales/da/languages.yml +36 -36
  54. data/resources/locales/da/layout.yml +5 -0
  55. data/resources/locales/da/lists.yml +7 -0
  56. data/resources/locales/da/numbers.yml +37 -37
  57. data/resources/locales/da/plurals.yml +2 -3
  58. data/resources/locales/da/units.yml +97 -97
  59. data/resources/locales/de/calendars.yml +71 -71
  60. data/resources/locales/de/languages.yml +51 -51
  61. data/resources/locales/de/layout.yml +5 -0
  62. data/resources/locales/de/lists.yml +7 -0
  63. data/resources/locales/de/numbers.yml +36 -36
  64. data/resources/locales/de/plurals.yml +2 -3
  65. data/resources/locales/de/units.yml +108 -108
  66. data/resources/locales/el/calendars.yml +213 -212
  67. data/resources/locales/el/languages.yml +520 -520
  68. data/resources/locales/el/layout.yml +5 -0
  69. data/resources/locales/el/lists.yml +7 -0
  70. data/resources/locales/el/numbers.yml +39 -39
  71. data/resources/locales/el/plurals.yml +2 -3
  72. data/resources/locales/el/units.yml +143 -143
  73. data/resources/locales/en/calendars.yml +66 -65
  74. data/resources/locales/en/languages.yml +24 -24
  75. data/resources/locales/en/layout.yml +5 -0
  76. data/resources/locales/en/lists.yml +7 -0
  77. data/resources/locales/en/numbers.yml +27 -27
  78. data/resources/locales/en/plurals.yml +2 -3
  79. data/resources/locales/en/units.yml +94 -94
  80. data/resources/locales/es/calendars.yml +80 -79
  81. data/resources/locales/es/languages.yml +139 -139
  82. data/resources/locales/es/layout.yml +5 -0
  83. data/resources/locales/es/lists.yml +7 -0
  84. data/resources/locales/es/numbers.yml +36 -36
  85. data/resources/locales/es/plurals.yml +2 -3
  86. data/resources/locales/es/units.yml +96 -96
  87. data/resources/locales/eu/calendars.yml +68 -67
  88. data/resources/locales/eu/languages.yml +11 -11
  89. data/resources/locales/eu/layout.yml +5 -0
  90. data/resources/locales/eu/lists.yml +7 -0
  91. data/resources/locales/eu/numbers.yml +36 -36
  92. data/resources/locales/eu/plurals.yml +2 -3
  93. data/resources/locales/eu/units.yml +80 -80
  94. data/resources/locales/fa/calendars.yml +223 -222
  95. data/resources/locales/fa/languages.yml +489 -489
  96. data/resources/locales/fa/layout.yml +5 -0
  97. data/resources/locales/fa/lists.yml +7 -0
  98. data/resources/locales/fa/numbers.yml +26 -26
  99. data/resources/locales/fa/plurals.yml +2 -3
  100. data/resources/locales/fa/units.yml +122 -122
  101. data/resources/locales/fi/calendars.yml +87 -87
  102. data/resources/locales/fi/languages.yml +86 -86
  103. data/resources/locales/fi/layout.yml +5 -0
  104. data/resources/locales/fi/lists.yml +7 -0
  105. data/resources/locales/fi/numbers.yml +41 -41
  106. data/resources/locales/fi/plurals.yml +2 -3
  107. data/resources/locales/fi/units.yml +124 -124
  108. data/resources/locales/fil/calendars.yml +68 -67
  109. data/resources/locales/fil/languages.yml +19 -19
  110. data/resources/locales/fil/layout.yml +5 -0
  111. data/resources/locales/fil/lists.yml +7 -0
  112. data/resources/locales/fil/numbers.yml +27 -27
  113. data/resources/locales/fil/plurals.yml +2 -3
  114. data/resources/locales/fil/units.yml +80 -80
  115. data/resources/locales/fr/calendars.yml +83 -83
  116. data/resources/locales/fr/languages.yml +117 -117
  117. data/resources/locales/fr/layout.yml +5 -0
  118. data/resources/locales/fr/lists.yml +7 -0
  119. data/resources/locales/fr/numbers.yml +37 -37
  120. data/resources/locales/fr/plurals.yml +2 -3
  121. data/resources/locales/fr/units.yml +80 -80
  122. data/resources/locales/he/calendars.yml +155 -154
  123. data/resources/locales/he/languages.yml +282 -282
  124. data/resources/locales/he/layout.yml +5 -0
  125. data/resources/locales/he/lists.yml +7 -0
  126. data/resources/locales/he/numbers.yml +27 -27
  127. data/resources/locales/he/plurals.yml +2 -3
  128. data/resources/locales/he/units.yml +122 -122
  129. data/resources/locales/hi/calendars.yml +132 -131
  130. data/resources/locales/hi/languages.yml +511 -511
  131. data/resources/locales/hi/layout.yml +5 -0
  132. data/resources/locales/hi/lists.yml +7 -0
  133. data/resources/locales/hi/numbers.yml +27 -27
  134. data/resources/locales/hi/plurals.yml +2 -3
  135. data/resources/locales/hi/units.yml +122 -122
  136. data/resources/locales/hu/calendars.yml +121 -120
  137. data/resources/locales/hu/languages.yml +214 -214
  138. data/resources/locales/hu/layout.yml +5 -0
  139. data/resources/locales/hu/lists.yml +7 -0
  140. data/resources/locales/hu/numbers.yml +39 -39
  141. data/resources/locales/hu/plurals.yml +2 -3
  142. data/resources/locales/hu/units.yml +102 -102
  143. data/resources/locales/id/calendars.yml +68 -67
  144. data/resources/locales/id/languages.yml +21 -21
  145. data/resources/locales/id/layout.yml +5 -0
  146. data/resources/locales/id/lists.yml +7 -0
  147. data/resources/locales/id/numbers.yml +37 -37
  148. data/resources/locales/id/plurals.yml +2 -3
  149. data/resources/locales/id/units.yml +73 -73
  150. data/resources/locales/it/calendars.yml +81 -80
  151. data/resources/locales/it/languages.yml +20 -20
  152. data/resources/locales/it/layout.yml +5 -0
  153. data/resources/locales/it/lists.yml +7 -0
  154. data/resources/locales/it/numbers.yml +36 -36
  155. data/resources/locales/it/plurals.yml +2 -3
  156. data/resources/locales/it/units.yml +94 -94
  157. data/resources/locales/ja/calendars.yml +123 -122
  158. data/resources/locales/ja/languages.yml +516 -516
  159. data/resources/locales/ja/layout.yml +5 -0
  160. data/resources/locales/ja/lists.yml +7 -0
  161. data/resources/locales/ja/numbers.yml +38 -38
  162. data/resources/locales/ja/plurals.yml +2 -3
  163. data/resources/locales/ja/units.yml +108 -108
  164. data/resources/locales/ko/calendars.yml +141 -140
  165. data/resources/locales/ko/languages.yml +509 -509
  166. data/resources/locales/ko/layout.yml +5 -0
  167. data/resources/locales/ko/lists.yml +7 -0
  168. data/resources/locales/ko/numbers.yml +37 -37
  169. data/resources/locales/ko/plurals.yml +2 -3
  170. data/resources/locales/ko/units.yml +108 -108
  171. data/resources/locales/ms/calendars.yml +68 -67
  172. data/resources/locales/ms/languages.yml +19 -19
  173. data/resources/locales/ms/layout.yml +5 -0
  174. data/resources/locales/ms/lists.yml +7 -0
  175. data/resources/locales/ms/numbers.yml +26 -26
  176. data/resources/locales/ms/plurals.yml +2 -3
  177. data/resources/locales/ms/units.yml +73 -73
  178. data/resources/locales/nb/calendars.yml +78 -78
  179. data/resources/locales/nb/languages.yml +93 -93
  180. data/resources/locales/nb/layout.yml +5 -0
  181. data/resources/locales/nb/lists.yml +7 -0
  182. data/resources/locales/nb/numbers.yml +37 -37
  183. data/resources/locales/nb/plurals.yml +2 -3
  184. data/resources/locales/nb/units.yml +99 -99
  185. data/resources/locales/nl/calendars.yml +67 -67
  186. data/resources/locales/nl/languages.yml +30 -30
  187. data/resources/locales/nl/layout.yml +5 -0
  188. data/resources/locales/nl/lists.yml +7 -0
  189. data/resources/locales/nl/numbers.yml +36 -36
  190. data/resources/locales/nl/plurals.yml +2 -3
  191. data/resources/locales/nl/units.yml +87 -87
  192. data/resources/locales/pl/calendars.yml +102 -101
  193. data/resources/locales/pl/languages.yml +139 -139
  194. data/resources/locales/pl/layout.yml +5 -0
  195. data/resources/locales/pl/lists.yml +7 -0
  196. data/resources/locales/pl/numbers.yml +41 -41
  197. data/resources/locales/pl/plurals.yml +2 -5
  198. data/resources/locales/pl/units.yml +149 -149
  199. data/resources/locales/pt/calendars.yml +83 -83
  200. data/resources/locales/pt/languages.yml +161 -161
  201. data/resources/locales/pt/layout.yml +5 -0
  202. data/resources/locales/pt/lists.yml +7 -0
  203. data/resources/locales/pt/numbers.yml +39 -39
  204. data/resources/locales/pt/plurals.yml +2 -3
  205. data/resources/locales/pt/units.yml +110 -110
  206. data/resources/locales/ru/calendars.yml +213 -212
  207. data/resources/locales/ru/languages.yml +511 -511
  208. data/resources/locales/ru/layout.yml +5 -0
  209. data/resources/locales/ru/lists.yml +7 -0
  210. data/resources/locales/ru/numbers.yml +40 -40
  211. data/resources/locales/ru/plurals.yml +2 -5
  212. data/resources/locales/ru/units.yml +192 -192
  213. data/resources/locales/sv/calendars.yml +85 -85
  214. data/resources/locales/sv/languages.yml +108 -108
  215. data/resources/locales/sv/layout.yml +5 -0
  216. data/resources/locales/sv/lists.yml +7 -0
  217. data/resources/locales/sv/numbers.yml +39 -39
  218. data/resources/locales/sv/plurals.yml +2 -3
  219. data/resources/locales/sv/units.yml +116 -116
  220. data/resources/locales/th/calendars.yml +172 -171
  221. data/resources/locales/th/languages.yml +510 -510
  222. data/resources/locales/th/layout.yml +5 -0
  223. data/resources/locales/th/lists.yml +7 -0
  224. data/resources/locales/th/numbers.yml +38 -38
  225. data/resources/locales/th/plurals.yml +2 -3
  226. data/resources/locales/th/units.yml +107 -107
  227. data/resources/locales/tr/calendars.yml +117 -116
  228. data/resources/locales/tr/languages.yml +143 -143
  229. data/resources/locales/tr/layout.yml +5 -0
  230. data/resources/locales/tr/lists.yml +7 -0
  231. data/resources/locales/tr/numbers.yml +37 -37
  232. data/resources/locales/tr/plurals.yml +2 -3
  233. data/resources/locales/tr/units.yml +98 -98
  234. data/resources/locales/uk/calendars.yml +187 -186
  235. data/resources/locales/uk/languages.yml +520 -520
  236. data/resources/locales/uk/layout.yml +5 -0
  237. data/resources/locales/uk/lists.yml +7 -0
  238. data/resources/locales/uk/numbers.yml +44 -44
  239. data/resources/locales/uk/plurals.yml +2 -5
  240. data/resources/locales/uk/units.yml +192 -192
  241. data/resources/locales/ur/calendars.yml +112 -111
  242. data/resources/locales/ur/languages.yml +164 -164
  243. data/resources/locales/ur/layout.yml +5 -0
  244. data/resources/locales/ur/lists.yml +7 -0
  245. data/resources/locales/ur/numbers.yml +27 -27
  246. data/resources/locales/ur/plurals.yml +2 -3
  247. data/resources/locales/ur/units.yml +136 -136
  248. data/resources/locales/zh/calendars.yml +212 -211
  249. data/resources/locales/zh/languages.yml +506 -506
  250. data/resources/locales/zh/layout.yml +5 -0
  251. data/resources/locales/zh/lists.yml +7 -0
  252. data/resources/locales/zh/numbers.yml +37 -37
  253. data/resources/locales/zh/plurals.yml +2 -3
  254. data/resources/locales/zh/units.yml +108 -108
  255. data/resources/locales/zh-Hant/calendars.yml +159 -158
  256. data/resources/locales/zh-Hant/languages.yml +510 -510
  257. data/resources/locales/zh-Hant/layout.yml +5 -0
  258. data/resources/locales/zh-Hant/lists.yml +7 -0
  259. data/resources/locales/zh-Hant/numbers.yml +38 -38
  260. data/resources/locales/zh-Hant/plurals.yml +2 -3
  261. data/resources/locales/zh-Hant/units.yml +108 -108
  262. data/spec/bidi/bidi_spec.rb +72 -0
  263. data/spec/bidi/classpath_bidi_test.txt +217202 -0
  264. data/spec/collation/tailoring_tests/da.txt +1 -1
  265. data/spec/collation/tailoring_tests/fi.txt +1 -7
  266. data/spec/collation/tailoring_tests/zh-Hant.txt +1 -1
  267. data/spec/formatters/list_formatter_spec.rb +119 -0
  268. data/spec/localized/localized_array_spec.rb +28 -0
  269. data/spec/localized/localized_hash_spec.rb +22 -0
  270. data/spec/localized/localized_number_spec.rb +3 -3
  271. data/spec/localized/localized_string_spec.rb +52 -1
  272. data/spec/localized/localized_symbol_spec.rb +7 -0
  273. data/spec/normalization/base_spec.rb +2 -4
  274. data/spec/shared/languages_spec.rb +21 -0
  275. data/spec/shared/numbers_spec.rb +4 -4
  276. data/spec/spec_helper.rb +3 -1
  277. data/spec/utils/yaml/t.gif +0 -0
  278. data/spec/utils/yaml/t.yaml +5 -0
  279. data/spec/utils/yaml/yaml_spec.rb +426 -0
  280. metadata +82 -2
@@ -0,0 +1,5 @@
1
+ ---
2
+ :"zh-Hant":
3
+ :layout:
4
+ :orientation: {}
5
+
@@ -0,0 +1,7 @@
1
+ ---
2
+ :"zh-Hant":
3
+ :lists:
4
+ 2: "{0}\xE5\x92\x8C{1}"
5
+ :end: "{0}\xE5\x92\x8C{1}"
6
+ :middle: "{0}\xE3\x80\x81{1}"
7
+ :start: "{0}\xE3\x80\x81{1}"
@@ -1,43 +1,43 @@
1
- ---
2
- :zh-Hant:
3
- :numbers:
4
- :formats:
5
- :currency:
6
- :patterns:
7
- :default: ¤#,##0.00
8
- :unit:
9
- :other: ! '{0} {1}'
10
- :decimal:
11
- :patterns:
12
- :default: ! '#,##0.###'
13
- :short:
1
+ ---
2
+ :"zh-Hant":
3
+ :numbers:
4
+ :formats:
5
+ :currency:
6
+ :patterns:
7
+ :default: "\xC2\xA4#,##0.00"
8
+ :unit:
9
+ :other: "{0} {1}"
10
+ :decimal:
11
+ :patterns:
12
+ :default: "#,##0.###"
13
+ :short:
14
14
  1000: 0
15
- 10000: 0.0
16
- 100000: 00
17
- 1000000: 000
18
- 10000000: 0000
19
- 100000000: 0.0
20
- 1000000000: 00
21
- 10000000000: 000
22
- 100000000000: 0000
23
- 1000000000000: 0.0
24
- 10000000000000: 00
25
- 100000000000000: 000
26
- :percent:
27
- :patterns:
28
- :default: ! '#,##0%'
29
- :scientific:
30
- :patterns:
31
- :default: ! '#E0'
32
- :symbols:
33
- :alias: ''
15
+ 10000: "0.0\xE8\x90\xAC"
16
+ 100000: "00\xE8\x90\xAC"
17
+ 1000000: "000\xE8\x90\xAC"
18
+ 10000000: "0000\xE8\x90\xAC"
19
+ 100000000: "0.0\xE5\x84\x84"
20
+ 1000000000: "00\xE5\x84\x84"
21
+ 10000000000: "000\xE5\x84\x84"
22
+ 100000000000: "0000\xE5\x84\x84"
23
+ 1000000000000: "0.0\xE5\x85\x86"
24
+ 10000000000000: "00\xE5\x85\x86"
25
+ 100000000000000: "000\xE5\x85\x86"
26
+ :percent:
27
+ :patterns:
28
+ :default: "#,##0%"
29
+ :scientific:
30
+ :patterns:
31
+ :default: "#E0"
32
+ :symbols:
33
+ :alias: ""
34
34
  :decimal: .
35
35
  :exponential: E
36
- :group: ! ','
37
- :infinity:
36
+ :group: ","
37
+ :infinity: "\xE2\x88\x9E"
38
38
  :list: ;
39
- :minus_sign: ! '-'
40
- :nan: 非數值
41
- :per_mille:
42
- :percent_sign: ! '%'
39
+ :minus_sign: "-"
40
+ :nan: "\xE9\x9D\x9E\xE6\x95\xB8\xE5\x80\xBC"
41
+ :per_mille: "\xE2\x80\xB0"
42
+ :percent_sign: "%"
43
43
  :plus_sign: +
@@ -1,3 +1,2 @@
1
- ---
2
- :zh-Hant: ! '{ :''zh-Hant'' => { :i18n => {:plural => { :keys => [:other], :rule =>
3
- lambda { |n| :other } } } } }'
1
+ ---
2
+ :"zh-Hant": "{ :'zh-Hant' => { :i18n => {:plural => { :keys => [:other], :rule => lambda { |n| :other } } } } }"
@@ -1,108 +1,108 @@
1
- ---
2
- :zh-Hant:
3
- :units:
4
- :day:
5
- :default:
6
- :other: ! '{0}日'
7
- :short:
8
- :other: ! '{0}日'
9
- :day-future:
10
- :default:
11
- 0: 0 天後
12
- 1: 1 天後
13
- :other: ! '{0} 天後'
14
- :day-past:
15
- :default:
16
- 0: 0 天前
17
- 1: 1 天前
18
- :other: ! '{0} 天前'
19
- :hour:
20
- :default:
21
- :other: ! '{0}小時'
22
- :short:
23
- :other: ! '{0}小時'
24
- :hour-future:
25
- :default:
26
- 0: 0 小時後
27
- 1: 1 小時後
28
- :other: ! '{0} 小時後'
29
- :hour-past:
30
- :default:
31
- 0: 0 小時前
32
- 1: 1 小時前
33
- :other: ! '{0} 小時前'
34
- :minute:
35
- :default:
36
- :other: ! '{0}分'
37
- :short:
38
- :other: ! '{0}分'
39
- :minute-future:
40
- :default:
41
- 0: 0 分鐘後
42
- 1: 1 分鐘後
43
- :other: ! '{0} 分鐘後'
44
- :minute-past:
45
- :default:
46
- 0: 0 分鐘前
47
- 1: 1 分鐘前
48
- :other: ! '{0} 分鐘前'
49
- :month:
50
- :default:
51
- :other: ! '{0}月'
52
- :short:
53
- :other: ! '{0}月'
54
- :month-future:
55
- :default:
56
- 0: 0 個月後
57
- 1: 1 個月後
58
- :other: ! '{0} 個月後'
59
- :month-past:
60
- :default:
61
- 0: 0 個月前
62
- 1: 1 個月前
63
- :other: ! '{0} 個月前'
64
- :second:
65
- :default:
66
- :other: ! '{0}秒'
67
- :short:
68
- :other: ! '{0}秒'
69
- :second-future:
70
- :default:
71
- 0: 0 秒後
72
- 1: 1 秒後
73
- :other: ! '{0} 秒後'
74
- :second-past:
75
- :default:
76
- 0: 0 秒前
77
- 1: 1 秒前
78
- :other: ! '{0} 秒前'
79
- :week:
80
- :default:
81
- :other: ! '{0}週'
82
- :short:
83
- :other: ! '{0}週'
84
- :week-future:
85
- :default:
86
- 0: 0 週後
87
- 1: 1 週後
88
- :other: ! '{0} 週後'
89
- :week-past:
90
- :default:
91
- 0: 0 週前
92
- 1: 1 週前
93
- :other: ! '{0} 週前'
94
- :year:
95
- :default:
96
- :other: ! '{0}年'
97
- :short:
98
- :other: ! '{0}年'
99
- :year-future:
100
- :default:
101
- 0: 0 年後
102
- 1: 1 年後
103
- :other: ! '{0} 年後'
104
- :year-past:
105
- :default:
106
- 0: 0 年前
107
- 1: 1 年前
108
- :other: ! '{0} 年前'
1
+ ---
2
+ :"zh-Hant":
3
+ :units:
4
+ :day:
5
+ :default:
6
+ :other: "{0}\xE6\x97\xA5"
7
+ :short:
8
+ :other: "{0}\xE6\x97\xA5"
9
+ :"day-future":
10
+ :default:
11
+ 0: "0 \xE5\xA4\xA9\xE5\xBE\x8C"
12
+ 1: "1 \xE5\xA4\xA9\xE5\xBE\x8C"
13
+ :other: "{0} \xE5\xA4\xA9\xE5\xBE\x8C"
14
+ :"day-past":
15
+ :default:
16
+ 0: "0 \xE5\xA4\xA9\xE5\x89\x8D"
17
+ 1: "1 \xE5\xA4\xA9\xE5\x89\x8D"
18
+ :other: "{0} \xE5\xA4\xA9\xE5\x89\x8D"
19
+ :hour:
20
+ :default:
21
+ :other: "{0}\xE5\xB0\x8F\xE6\x99\x82"
22
+ :short:
23
+ :other: "{0}\xE5\xB0\x8F\xE6\x99\x82"
24
+ :"hour-future":
25
+ :default:
26
+ 0: "0 \xE5\xB0\x8F\xE6\x99\x82\xE5\xBE\x8C"
27
+ 1: "1 \xE5\xB0\x8F\xE6\x99\x82\xE5\xBE\x8C"
28
+ :other: "{0} \xE5\xB0\x8F\xE6\x99\x82\xE5\xBE\x8C"
29
+ :"hour-past":
30
+ :default:
31
+ 0: "0 \xE5\xB0\x8F\xE6\x99\x82\xE5\x89\x8D"
32
+ 1: "1 \xE5\xB0\x8F\xE6\x99\x82\xE5\x89\x8D"
33
+ :other: "{0} \xE5\xB0\x8F\xE6\x99\x82\xE5\x89\x8D"
34
+ :minute:
35
+ :default:
36
+ :other: "{0}\xE5\x88\x86"
37
+ :short:
38
+ :other: "{0}\xE5\x88\x86"
39
+ :"minute-future":
40
+ :default:
41
+ 0: "0 \xE5\x88\x86\xE9\x90\x98\xE5\xBE\x8C"
42
+ 1: "1 \xE5\x88\x86\xE9\x90\x98\xE5\xBE\x8C"
43
+ :other: "{0} \xE5\x88\x86\xE9\x90\x98\xE5\xBE\x8C"
44
+ :"minute-past":
45
+ :default:
46
+ 0: "0 \xE5\x88\x86\xE9\x90\x98\xE5\x89\x8D"
47
+ 1: "1 \xE5\x88\x86\xE9\x90\x98\xE5\x89\x8D"
48
+ :other: "{0} \xE5\x88\x86\xE9\x90\x98\xE5\x89\x8D"
49
+ :month:
50
+ :default:
51
+ :other: "{0}\xE6\x9C\x88"
52
+ :short:
53
+ :other: "{0}\xE6\x9C\x88"
54
+ :"month-future":
55
+ :default:
56
+ 0: "0 \xE5\x80\x8B\xE6\x9C\x88\xE5\xBE\x8C"
57
+ 1: "1 \xE5\x80\x8B\xE6\x9C\x88\xE5\xBE\x8C"
58
+ :other: "{0} \xE5\x80\x8B\xE6\x9C\x88\xE5\xBE\x8C"
59
+ :"month-past":
60
+ :default:
61
+ 0: "0 \xE5\x80\x8B\xE6\x9C\x88\xE5\x89\x8D"
62
+ 1: "1 \xE5\x80\x8B\xE6\x9C\x88\xE5\x89\x8D"
63
+ :other: "{0} \xE5\x80\x8B\xE6\x9C\x88\xE5\x89\x8D"
64
+ :second:
65
+ :default:
66
+ :other: "{0}\xE7\xA7\x92"
67
+ :short:
68
+ :other: "{0}\xE7\xA7\x92"
69
+ :"second-future":
70
+ :default:
71
+ 0: "0 \xE7\xA7\x92\xE5\xBE\x8C"
72
+ 1: "1 \xE7\xA7\x92\xE5\xBE\x8C"
73
+ :other: "{0} \xE7\xA7\x92\xE5\xBE\x8C"
74
+ :"second-past":
75
+ :default:
76
+ 0: "0 \xE7\xA7\x92\xE5\x89\x8D"
77
+ 1: "1 \xE7\xA7\x92\xE5\x89\x8D"
78
+ :other: "{0} \xE7\xA7\x92\xE5\x89\x8D"
79
+ :week:
80
+ :default:
81
+ :other: "{0}\xE9\x80\xB1"
82
+ :short:
83
+ :other: "{0}\xE9\x80\xB1"
84
+ :"week-future":
85
+ :default:
86
+ 0: "0 \xE9\x80\xB1\xE5\xBE\x8C"
87
+ 1: "1 \xE9\x80\xB1\xE5\xBE\x8C"
88
+ :other: "{0} \xE9\x80\xB1\xE5\xBE\x8C"
89
+ :"week-past":
90
+ :default:
91
+ 0: "0 \xE9\x80\xB1\xE5\x89\x8D"
92
+ 1: "1 \xE9\x80\xB1\xE5\x89\x8D"
93
+ :other: "{0} \xE9\x80\xB1\xE5\x89\x8D"
94
+ :year:
95
+ :default:
96
+ :other: "{0}\xE5\xB9\xB4"
97
+ :short:
98
+ :other: "{0}\xE5\xB9\xB4"
99
+ :"year-future":
100
+ :default:
101
+ 0: "0 \xE5\xB9\xB4\xE5\xBE\x8C"
102
+ 1: "1 \xE5\xB9\xB4\xE5\xBE\x8C"
103
+ :other: "{0} \xE5\xB9\xB4\xE5\xBE\x8C"
104
+ :"year-past":
105
+ :default:
106
+ 0: "0 \xE5\xB9\xB4\xE5\x89\x8D"
107
+ 1: "1 \xE5\xB9\xB4\xE5\x89\x8D"
108
+ :other: "{0} \xE5\xB9\xB4\xE5\x89\x8D"
@@ -0,0 +1,72 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Twitter, Inc
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ # What's going on here?
7
+ # It's a bit too complicated to pass all the original Unicode Bidi tests, so we build our own suite against
8
+ # the GNU classpath verison of the Bidi algorithm. See lib/resources/bidi_test_importer.rb for the
9
+ # implementation of the test file generator.
10
+
11
+ require 'spec_helper'
12
+
13
+ include TwitterCldr::Shared
14
+
15
+ BIDI_TEST_PATH = File.join(File.dirname(__FILE__), 'classpath_bidi_test.txt')
16
+ DIRECTIONS = [nil, :LTR, :RTL]
17
+
18
+ def expand_bitset_str(bitset)
19
+ bitset.to_i.to_s(2).rjust(3, "0").chars.to_a.map { |i| i == "1" }.reverse
20
+ end
21
+
22
+ describe Bidi do
23
+ it "should pass the derived tests in classpath_bidi_test.txt" do
24
+ expected_level_data = []
25
+ expected_reorder_data = []
26
+ num_failed = 0
27
+
28
+ File.open(BIDI_TEST_PATH, 'r').each_line do |s|
29
+ cur_line = s.strip
30
+ first_char = cur_line[0]
31
+ first_char = first_char.chr if first_char.is_a?(Fixnum) # conversion for ruby 1.8
32
+
33
+ case first_char
34
+ when "#"
35
+ next
36
+ when "@"
37
+ if cur_line.include?("@Levels:")
38
+ expected_level_data = cur_line.gsub("@Levels:", "").strip.split(" ").map(&:to_i)
39
+ end
40
+
41
+ if cur_line.include?("@Reorder:")
42
+ expected_reorder_data = cur_line.gsub("@Reorder:", "").strip.split(" ").map(&:to_i)
43
+ end
44
+ else
45
+ input, bitset = cur_line.split("; ")
46
+ result_list = []
47
+
48
+ expand_bitset_str(bitset).each_with_index do |check, index|
49
+ if check
50
+ types = input.split(" ").map(&:to_sym)
51
+ bidi = TwitterCldr::Shared::Bidi.from_type_array(types, :direction => DIRECTIONS[index], :default_direction => :LTR)
52
+
53
+ passed = bidi.levels.each_with_index.all? do |level, idx|
54
+ level == expected_level_data[idx]
55
+ end
56
+
57
+ bidi.instance_variable_set(:'@string_arr', (0..5).to_a[0...types.size])
58
+ bidi.reorder_visually!
59
+
60
+ passed &&= bidi.string_arr.each_with_index.all? do |position, idx|
61
+ position == expected_reorder_data[idx]
62
+ end
63
+
64
+ num_failed += 1 unless passed
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ num_failed.should == 0
71
+ end
72
+ end