twitter_cldr 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +18 -2
  4. data/Rakefile +39 -122
  5. data/lib/twitter_cldr.rb +3 -0
  6. data/lib/twitter_cldr/formatters/numbers/rbnf.rb +5 -1
  7. data/lib/twitter_cldr/resources.rb +86 -5
  8. data/lib/twitter_cldr/resources/bidi_test_importer.rb +50 -44
  9. data/lib/twitter_cldr/resources/casefolder_class_generator.rb +22 -13
  10. data/lib/twitter_cldr/resources/collation_tries_importer.rb +44 -0
  11. data/lib/twitter_cldr/resources/hyphenation_importer.rb +16 -42
  12. data/lib/twitter_cldr/resources/import_resolver.rb +71 -0
  13. data/lib/twitter_cldr/resources/importer.rb +107 -0
  14. data/lib/twitter_cldr/resources/language_codes_importer.rb +35 -38
  15. data/lib/twitter_cldr/resources/loader.rb +3 -3
  16. data/lib/twitter_cldr/resources/locales_resources_importer.rb +48 -35
  17. data/lib/twitter_cldr/resources/phone_codes_importer.rb +24 -23
  18. data/lib/twitter_cldr/resources/postal_codes_importer.rb +10 -11
  19. data/lib/twitter_cldr/resources/properties.rb +0 -4
  20. data/lib/twitter_cldr/resources/properties/age_property_importer.rb +13 -9
  21. data/lib/twitter_cldr/resources/properties/arabic_shaping_property_importer.rb +9 -11
  22. data/lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb +11 -9
  23. data/lib/twitter_cldr/resources/properties/blocks_property_importer.rb +13 -9
  24. data/lib/twitter_cldr/resources/properties/derived_core_properties_importer.rb +9 -11
  25. data/lib/twitter_cldr/resources/properties/east_asian_width_property_importer.rb +13 -9
  26. data/lib/twitter_cldr/resources/properties/grapheme_break_property_importer.rb +13 -9
  27. data/lib/twitter_cldr/resources/properties/hangul_syllable_type_property_importer.rb +13 -9
  28. data/lib/twitter_cldr/resources/properties/indic_positional_category_property_importer.rb +13 -9
  29. data/lib/twitter_cldr/resources/properties/indic_syllabic_category_property_importer.rb +13 -9
  30. data/lib/twitter_cldr/resources/properties/jamo_property_importer.rb +13 -9
  31. data/lib/twitter_cldr/resources/properties/line_break_property_importer.rb +13 -9
  32. data/lib/twitter_cldr/resources/properties/prop_list_importer.rb +9 -11
  33. data/lib/twitter_cldr/resources/properties/property_importer.rb +13 -22
  34. data/lib/twitter_cldr/resources/properties/script_extensions_property_importer.rb +12 -10
  35. data/lib/twitter_cldr/resources/properties/script_property_importer.rb +13 -9
  36. data/lib/twitter_cldr/resources/properties/sentence_break_property_importer.rb +13 -9
  37. data/lib/twitter_cldr/resources/properties/unicode_data_properties_importer.rb +11 -9
  38. data/lib/twitter_cldr/resources/properties/word_break_property_importer.rb +13 -9
  39. data/lib/twitter_cldr/resources/rbnf_test_importer.rb +41 -38
  40. data/lib/twitter_cldr/resources/readme_renderer.rb +1 -2
  41. data/lib/twitter_cldr/resources/requirements.rb +18 -0
  42. data/lib/twitter_cldr/resources/requirements/cldr_requirement.rb +66 -0
  43. data/lib/twitter_cldr/resources/requirements/dependency_requirement.rb +23 -0
  44. data/lib/twitter_cldr/resources/requirements/git_requirement.rb +66 -0
  45. data/lib/twitter_cldr/resources/requirements/icu_requirement.rb +111 -0
  46. data/lib/twitter_cldr/resources/requirements/unicode_requirement.rb +51 -0
  47. data/lib/twitter_cldr/resources/segment_tests_importer.rb +15 -30
  48. data/lib/twitter_cldr/resources/tailoring_importer.rb +33 -26
  49. data/lib/twitter_cldr/resources/transform_test_importer.rb +15 -17
  50. data/lib/twitter_cldr/resources/uli/segment_exceptions_importer.rb +29 -17
  51. data/lib/twitter_cldr/resources/unicode_data_importer.rb +38 -31
  52. data/lib/twitter_cldr/resources/unicode_file_parser.rb +37 -0
  53. data/lib/twitter_cldr/resources/unicode_property_aliases_importer.rb +23 -27
  54. data/lib/twitter_cldr/shared/casefolder.rb +139 -115
  55. data/lib/twitter_cldr/version.rb +1 -1
  56. data/lib/twitter_cldr/versions.rb +0 -4
  57. data/resources/collation/tailoring/bo.yml +4 -0
  58. data/resources/collation/tries/bo.dump +0 -0
  59. data/resources/locales/bo/calendars.yml +247 -0
  60. data/resources/locales/bo/currencies.yml +208 -0
  61. data/resources/locales/bo/fields.yml +31 -0
  62. data/resources/locales/bo/languages.yml +24 -0
  63. data/resources/locales/bo/layout.yml +5 -0
  64. data/resources/locales/bo/lists.yml +12 -0
  65. data/resources/locales/bo/numbers.yml +111 -0
  66. data/resources/locales/bo/plural_rules.yml +6 -0
  67. data/resources/locales/bo/plurals.yml +12 -0
  68. data/resources/locales/bo/territories.yml +14 -0
  69. data/resources/locales/bo/units.yml +283 -0
  70. data/resources/shared/transforms/Arab-Latn.yml +109 -0
  71. data/resources/shared/transforms/Beng-Deva.yml +13 -0
  72. data/resources/shared/transforms/Beng-Gujr.yml +13 -0
  73. data/resources/shared/transforms/Beng-Guru.yml +13 -0
  74. data/resources/shared/transforms/Beng-Knda.yml +13 -0
  75. data/resources/shared/transforms/Beng-Latn.yml +13 -0
  76. data/resources/shared/transforms/Beng-Mlym.yml +13 -0
  77. data/resources/shared/transforms/Beng-Orya.yml +13 -0
  78. data/resources/shared/transforms/Beng-Taml.yml +13 -0
  79. data/resources/shared/transforms/Beng-Telu.yml +13 -0
  80. data/resources/shared/transforms/Cyrl-Latn.yml +128 -0
  81. data/resources/shared/transforms/Deva-Beng.yml +13 -0
  82. data/resources/shared/transforms/Deva-Gujr.yml +13 -0
  83. data/resources/shared/transforms/Deva-Guru.yml +13 -0
  84. data/resources/shared/transforms/Deva-Knda.yml +13 -0
  85. data/resources/shared/transforms/Deva-Latn.yml +13 -0
  86. data/resources/shared/transforms/Deva-Mlym.yml +13 -0
  87. data/resources/shared/transforms/Deva-Orya.yml +13 -0
  88. data/resources/shared/transforms/Deva-Taml.yml +13 -0
  89. data/resources/shared/transforms/Deva-Telu.yml +13 -0
  90. data/resources/shared/transforms/Geor-Latn.yml +43 -0
  91. data/resources/shared/transforms/Grek-Latn-UNGEGN.yml +160 -0
  92. data/resources/shared/transforms/Grek-Latn.yml +206 -0
  93. data/resources/shared/transforms/Gujr-Beng.yml +13 -0
  94. data/resources/shared/transforms/Gujr-Deva.yml +13 -0
  95. data/resources/shared/transforms/Gujr-Guru.yml +13 -0
  96. data/resources/shared/transforms/Gujr-Knda.yml +13 -0
  97. data/resources/shared/transforms/Gujr-Latn.yml +13 -0
  98. data/resources/shared/transforms/Gujr-Mlym.yml +13 -0
  99. data/resources/shared/transforms/Gujr-Orya.yml +13 -0
  100. data/resources/shared/transforms/Gujr-Taml.yml +13 -0
  101. data/resources/shared/transforms/Gujr-Telu.yml +13 -0
  102. data/resources/shared/transforms/Guru-Beng.yml +13 -0
  103. data/resources/shared/transforms/Guru-Deva.yml +13 -0
  104. data/resources/shared/transforms/Guru-Gujr.yml +13 -0
  105. data/resources/shared/transforms/Guru-Knda.yml +13 -0
  106. data/resources/shared/transforms/Guru-Latn.yml +13 -0
  107. data/resources/shared/transforms/Guru-Mlym.yml +13 -0
  108. data/resources/shared/transforms/Guru-Orya.yml +13 -0
  109. data/resources/shared/transforms/Guru-Taml.yml +13 -0
  110. data/resources/shared/transforms/Guru-Telu.yml +13 -0
  111. data/resources/shared/transforms/Han-Spacedhan.yml +1 -1
  112. data/resources/shared/transforms/Hang-Latn.yml +12 -0
  113. data/resources/shared/transforms/Hani-Latn.yml +1605 -0
  114. data/resources/shared/transforms/Hans-Hant.yml +3982 -0
  115. data/resources/shared/transforms/Hebr-Latn.yml +72 -0
  116. data/resources/shared/transforms/Hira-Kana.yml +114 -0
  117. data/resources/shared/transforms/Hira-Latn.yml +15 -0
  118. data/resources/shared/transforms/InterIndic-Latin.yml +2 -2
  119. data/resources/shared/transforms/Jamo-Latn.yml +12 -0
  120. data/resources/shared/transforms/Knda-Beng.yml +13 -0
  121. data/resources/shared/transforms/Knda-Deva.yml +13 -0
  122. data/resources/shared/transforms/Knda-Gujr.yml +13 -0
  123. data/resources/shared/transforms/Knda-Guru.yml +13 -0
  124. data/resources/shared/transforms/Knda-Latn.yml +13 -0
  125. data/resources/shared/transforms/Knda-Mlym.yml +13 -0
  126. data/resources/shared/transforms/Knda-Orya.yml +13 -0
  127. data/resources/shared/transforms/Knda-Taml.yml +13 -0
  128. data/resources/shared/transforms/Knda-Telu.yml +13 -0
  129. data/resources/shared/transforms/Latin-ASCII.yml +16 -1
  130. data/resources/shared/transforms/Latin-InterIndic.yml +2 -2
  131. data/resources/shared/transforms/Latn-Armn.yml +90 -0
  132. data/resources/shared/transforms/Latn-Beng.yml +14 -0
  133. data/resources/shared/transforms/Latn-Bopo.yml +1336 -0
  134. data/resources/shared/transforms/Latn-Cans.yml +190 -0
  135. data/resources/shared/transforms/Latn-Deva.yml +14 -0
  136. data/resources/shared/transforms/Latn-Ethi.yml +278 -0
  137. data/resources/shared/transforms/Latn-Gujr.yml +14 -0
  138. data/resources/shared/transforms/Latn-Guru.yml +14 -0
  139. data/resources/shared/transforms/Latn-Hang.yml +13 -0
  140. data/resources/shared/transforms/Latn-Jamo.yml +13 -0
  141. data/resources/shared/transforms/Latn-Kana.yml +274 -0
  142. data/resources/shared/transforms/Latn-Knda.yml +14 -0
  143. data/resources/shared/transforms/Latn-Mlym.yml +14 -0
  144. data/resources/shared/transforms/Latn-Orya.yml +14 -0
  145. data/resources/shared/transforms/Latn-Taml.yml +14 -0
  146. data/resources/shared/transforms/Latn-Telu.yml +14 -0
  147. data/resources/shared/transforms/Latn-Thaa.yml +439 -0
  148. data/resources/shared/transforms/Latn-Thai.yml +13 -0
  149. data/resources/shared/transforms/Mlym-Beng.yml +13 -0
  150. data/resources/shared/transforms/Mlym-Deva.yml +13 -0
  151. data/resources/shared/transforms/Mlym-Gujr.yml +13 -0
  152. data/resources/shared/transforms/Mlym-Guru.yml +13 -0
  153. data/resources/shared/transforms/Mlym-Knda.yml +13 -0
  154. data/resources/shared/transforms/Mlym-Latn.yml +13 -0
  155. data/resources/shared/transforms/Mlym-Orya.yml +13 -0
  156. data/resources/shared/transforms/Mlym-Taml.yml +13 -0
  157. data/resources/shared/transforms/Mlym-Telu.yml +13 -0
  158. data/resources/shared/transforms/Orya-Beng.yml +13 -0
  159. data/resources/shared/transforms/Orya-Deva.yml +13 -0
  160. data/resources/shared/transforms/Orya-Gujr.yml +13 -0
  161. data/resources/shared/transforms/Orya-Guru.yml +13 -0
  162. data/resources/shared/transforms/Orya-Knda.yml +13 -0
  163. data/resources/shared/transforms/Orya-Latn.yml +13 -0
  164. data/resources/shared/transforms/Orya-Mlym.yml +13 -0
  165. data/resources/shared/transforms/Orya-Taml.yml +13 -0
  166. data/resources/shared/transforms/Orya-Telu.yml +13 -0
  167. data/resources/shared/transforms/Syrc-Latn.yml +55 -0
  168. data/resources/shared/transforms/Taml-Beng.yml +13 -0
  169. data/resources/shared/transforms/Taml-Deva.yml +13 -0
  170. data/resources/shared/transforms/Taml-Gujr.yml +13 -0
  171. data/resources/shared/transforms/Taml-Guru.yml +13 -0
  172. data/resources/shared/transforms/Taml-Knda.yml +13 -0
  173. data/resources/shared/transforms/Taml-Latn.yml +13 -0
  174. data/resources/shared/transforms/Taml-Mlym.yml +13 -0
  175. data/resources/shared/transforms/Taml-Orya.yml +13 -0
  176. data/resources/shared/transforms/Taml-Telu.yml +13 -0
  177. data/resources/shared/transforms/Telu-Beng.yml +13 -0
  178. data/resources/shared/transforms/Telu-Deva.yml +13 -0
  179. data/resources/shared/transforms/Telu-Gujr.yml +13 -0
  180. data/resources/shared/transforms/Telu-Guru.yml +13 -0
  181. data/resources/shared/transforms/Telu-Knda.yml +13 -0
  182. data/resources/shared/transforms/Telu-Latn.yml +13 -0
  183. data/resources/shared/transforms/Telu-Mlym.yml +13 -0
  184. data/resources/shared/transforms/Telu-Orya.yml +13 -0
  185. data/resources/shared/transforms/Telu-Taml.yml +13 -0
  186. data/resources/shared/transforms/Thai-Latn.yml +15 -0
  187. data/resources/shared/transforms/am-am_FONIPA.yml +609 -0
  188. data/resources/shared/transforms/am-am_Latn-BGN.yml +336 -0
  189. data/resources/shared/transforms/am-ar.yml +11 -0
  190. data/resources/shared/transforms/am-fa.yml +10 -0
  191. data/resources/shared/transforms/ar-ar_Latn-BGN.yml +122 -0
  192. data/resources/shared/transforms/az_Cyrl-az-BGN.yml +93 -0
  193. data/resources/shared/transforms/be-be_Latn-BGN.yml +108 -0
  194. data/resources/shared/transforms/bg-bg_Latn-BGN.yml +99 -0
  195. data/resources/shared/transforms/ch-am.yml +10 -0
  196. data/resources/shared/transforms/ch-ar.yml +10 -0
  197. data/resources/shared/transforms/ch-ch_FONIPA.yml +0 -8
  198. data/resources/shared/transforms/ch-fa.yml +10 -0
  199. data/resources/shared/transforms/cs-am.yml +10 -0
  200. data/resources/shared/transforms/cs-ar.yml +10 -0
  201. data/resources/shared/transforms/cs-fa.yml +10 -0
  202. data/resources/shared/transforms/dsb-dsb_FONIPA.yml +0 -5
  203. data/resources/shared/transforms/dv-dv_Latn-BGN.yml +112 -0
  204. data/resources/shared/transforms/el-el_Latn-BGN.yml +208 -0
  205. data/resources/shared/transforms/eo-am.yml +10 -0
  206. data/resources/shared/transforms/eo-ar.yml +10 -0
  207. data/resources/shared/transforms/eo-eo_FONIPA.yml +52 -0
  208. data/resources/shared/transforms/eo-fa.yml +10 -0
  209. data/resources/shared/transforms/es-ar.yml +13 -0
  210. data/resources/shared/transforms/es-fa.yml +13 -0
  211. data/resources/shared/transforms/es_419-am.yml +11 -0
  212. data/resources/shared/transforms/es_419-ar.yml +14 -0
  213. data/resources/shared/transforms/es_419-fa.yml +14 -0
  214. data/resources/shared/transforms/fa-fa_Latn-BGN.yml +123 -0
  215. data/resources/shared/transforms/he-he_Latn-BGN.yml +62 -0
  216. data/resources/shared/transforms/hy-am.yml +10 -0
  217. data/resources/shared/transforms/hy-ar.yml +10 -0
  218. data/resources/shared/transforms/hy-fa.yml +10 -0
  219. data/resources/shared/transforms/hy-hy_FONIPA.yml +56 -0
  220. data/resources/shared/transforms/hy-hy_Latn-BGN.yml +133 -0
  221. data/resources/shared/transforms/hy_AREVMDA-am.yml +10 -0
  222. data/resources/shared/transforms/hy_AREVMDA-ar.yml +10 -0
  223. data/resources/shared/transforms/hy_AREVMDA-fa.yml +10 -0
  224. data/resources/shared/transforms/hy_AREVMDA-hy_AREVMDA_FONIPA.yml +82 -0
  225. data/resources/shared/transforms/ia-am.yml +10 -0
  226. data/resources/shared/transforms/ia-ar.yml +10 -0
  227. data/resources/shared/transforms/ia-fa.yml +10 -0
  228. data/resources/shared/transforms/ia-ia_FONIPA.yml +69 -0
  229. data/resources/shared/transforms/ja_Hrkt-ja_Latn-BGN.yml +310 -0
  230. data/resources/shared/transforms/ka-ka_Latn-BGN.yml +44 -0
  231. data/resources/shared/transforms/kk-am.yml +10 -0
  232. data/resources/shared/transforms/kk-ar.yml +10 -0
  233. data/resources/shared/transforms/kk-fa.yml +10 -0
  234. data/resources/shared/transforms/kk-kk_FONIPA.yml +53 -0
  235. data/resources/shared/transforms/kk-kk_Latn-BGN.yml +136 -0
  236. data/resources/shared/transforms/ko-ko_Latn-BGN.yml +282 -0
  237. data/resources/shared/transforms/ky-am.yml +10 -0
  238. data/resources/shared/transforms/ky-ar.yml +10 -0
  239. data/resources/shared/transforms/ky-fa.yml +10 -0
  240. data/resources/shared/transforms/ky-ky_FONIPA.yml +73 -0
  241. data/resources/shared/transforms/ky-ky_Latn-BGN.yml +107 -0
  242. data/resources/shared/transforms/la-la_FONIPA.yml +0 -8
  243. data/resources/shared/transforms/mk-mk_Latn-BGN.yml +89 -0
  244. data/resources/shared/transforms/mn-mn_Latn-BGN.yml +101 -0
  245. data/resources/shared/transforms/mn-mn_Latn-MNS.yml +89 -0
  246. data/resources/shared/transforms/my-am.yml +10 -0
  247. data/resources/shared/transforms/my-ar.yml +10 -0
  248. data/resources/shared/transforms/my-fa.yml +10 -0
  249. data/resources/shared/transforms/my-my_FONIPA.yml +260 -0
  250. data/resources/shared/transforms/pl-am.yml +10 -0
  251. data/resources/shared/transforms/pl-ar.yml +10 -0
  252. data/resources/shared/transforms/pl-fa.yml +10 -0
  253. data/resources/shared/transforms/ps-ps_Latn-BGN.yml +151 -0
  254. data/resources/shared/transforms/rm_SURSILV-am.yml +10 -0
  255. data/resources/shared/transforms/rm_SURSILV-ar.yml +10 -0
  256. data/resources/shared/transforms/rm_SURSILV-fa.yml +10 -0
  257. data/resources/shared/transforms/rm_SURSILV-rm_FONIPA_SURSILV.yml +84 -0
  258. data/resources/shared/transforms/ro-am.yml +10 -0
  259. data/resources/shared/transforms/ro-ar.yml +10 -0
  260. data/resources/shared/transforms/ro-fa.yml +10 -0
  261. data/resources/shared/transforms/ro-ro_FONIPA.yml +38 -6
  262. data/resources/shared/transforms/ro_FONIPA-ja.yml +1 -0
  263. data/resources/shared/transforms/ru-ru_Latn-BGN.yml +121 -0
  264. data/resources/shared/transforms/ru_Latn-ru-BGN.yml +101 -0
  265. data/resources/shared/transforms/sat-am.yml +10 -0
  266. data/resources/shared/transforms/sat-ar.yml +10 -0
  267. data/resources/shared/transforms/sat-fa.yml +10 -0
  268. data/resources/shared/transforms/sat_Olck-sat_FONIPA.yml +132 -0
  269. data/resources/shared/transforms/si-am.yml +10 -0
  270. data/resources/shared/transforms/si-ar.yml +10 -0
  271. data/resources/shared/transforms/si-fa.yml +10 -0
  272. data/resources/shared/transforms/si-si_FONIPA.yml +128 -0
  273. data/resources/shared/transforms/si-si_Latn.yml +96 -0
  274. data/resources/shared/transforms/sk-am.yml +10 -0
  275. data/resources/shared/transforms/sk-ar.yml +10 -0
  276. data/resources/shared/transforms/sk-fa.yml +10 -0
  277. data/resources/shared/transforms/sk-sk_FONIPA.yml +18 -2
  278. data/resources/shared/transforms/sk_FONIPA-ja.yml +2 -0
  279. data/resources/shared/transforms/sr-sr_Latn-BGN.yml +81 -0
  280. data/resources/shared/transforms/tk_Cyrl-tk-BGN.yml +122 -0
  281. data/resources/shared/transforms/tlh-am.yml +10 -0
  282. data/resources/shared/transforms/tlh-ar.yml +10 -0
  283. data/resources/shared/transforms/tlh-fa.yml +10 -0
  284. data/resources/shared/transforms/tlh-tlh_FONIPA.yml +0 -8
  285. data/resources/shared/transforms/uk-uk_Latn-BGN.yml +115 -0
  286. data/resources/shared/transforms/und_FONIPA-ar.yml +96 -0
  287. data/resources/shared/transforms/und_FONIPA-fa.yml +88 -0
  288. data/resources/shared/transforms/und_FONIPA-und_FONXSAMP.yml +198 -0
  289. data/resources/shared/transforms/uz_Cyrl-uz-BGN.yml +117 -0
  290. data/resources/shared/transforms/xh-am.yml +10 -0
  291. data/resources/shared/transforms/xh-ar.yml +10 -0
  292. data/resources/shared/transforms/xh-fa.yml +10 -0
  293. data/resources/shared/transforms/xh-xh_FONIPA.yml +71 -0
  294. data/resources/shared/transforms/zu-am.yml +10 -0
  295. data/resources/shared/transforms/zu-ar.yml +10 -0
  296. data/resources/shared/transforms/zu-fa.yml +10 -0
  297. data/resources/shared/transforms/zu-zu_FONIPA.yml +58 -0
  298. data/spec/formatters/numbers/rbnf/rbnf_spec.rb +3 -1
  299. data/spec/resources/loader_spec.rb +12 -5
  300. data/spec/spec_helper.rb +1 -1
  301. metadata +242 -10
  302. data/History.txt +0 -282
  303. data/lib/twitter_cldr/resources/collation_tries_dumper.rb +0 -43
  304. data/lib/twitter_cldr/resources/custom_locales_resources_importer.rb +0 -80
  305. data/lib/twitter_cldr/resources/download.rb +0 -64
  306. data/lib/twitter_cldr/resources/icu_based_importer.rb +0 -18
  307. data/lib/twitter_cldr/resources/properties/properties_importer.rb +0 -59
  308. data/lib/twitter_cldr/resources/unicode_importer.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77d562387667ce48ca9f7fd86dfbfe300c387342
4
- data.tar.gz: 3269c97b2f7b47a84264c1c4766cd6fcf2205a97
3
+ metadata.gz: a54546f0097f539bcbad9d1b42bdaeba9bbb32dc
4
+ data.tar.gz: a6b3d7233e0f0b7bce65dd5af721c3bc8faac763
5
5
  SHA512:
6
- metadata.gz: 2ae5ee0153fd3c1c12aa558f7315d815af5f592a4924674adc5c8786fc87d402c5e7db65f62d48a1fbf7df596dc23f0997126eaee622c1af42f9e1e214763097
7
- data.tar.gz: f003b9f2514a86b1f1aa1af1ab1ffaf04c233f200b38e1d63a9bc52a80fc4f802ba2ea741602562d577a04f05086ec0234c8ed93f5b01cb570560a13452bfd2f
6
+ metadata.gz: f0fb42535a4efd6f02165cc23b0498c79889d28dc549e3128735a022b468ca73f500e26884036cd6f15b705ece4474d7a12d9994119936f1b310b657c5a5966c
7
+ data.tar.gz: cf4e0fffe9b0811b73cd4b672cce2444c0dc30d548f8d7d35b030edcec4ba3774097c44dd9d31e6bcdbe9611e9f8ed7fdd61ed673e3f3fec4436176ed4bceec2
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ end
12
12
  group :development do
13
13
  gem 'nokogiri', "~> 1.5.9"
14
14
 
15
- gem 'ruby-cldr', github: 'camertron/ruby-cldr', branch: 'fields'
15
+ gem 'ruby-cldr', github: 'camertron/ruby-cldr'
16
16
  gem 'i18n', '~> 0.6.11'
17
17
  gem 'cldr-plurals', '~> 1.0'
18
18
 
@@ -23,15 +23,16 @@ group :test do
23
23
  gem 'rspec', '~> 2.14.0'
24
24
  gem 'rr', '~> 1.1.2'
25
25
 
26
- gem 'rubyzip'
27
26
  gem 'term-ansicolor', '~> 1.3.0' # 1.4 breaks ruby 1.9 support
28
27
  gem 'coveralls', require: false
29
28
  gem 'tins', '~> 1.6.0', require: false # 1.7 breaks ruby 1.9 support
30
29
 
31
30
  gem 'simplecov'
32
31
  gem 'launchy'
32
+ gem 'addressable', '~> 2.4.0' # 2.5 breaks ruby 1.9 support
33
33
  end
34
34
 
35
35
  group :development, :test do
36
+ gem 'rubyzip', '~> 1.0'
36
37
  gem 'benchmark-ips'
37
38
  end
data/README.md CHANGED
@@ -18,7 +18,7 @@ require 'twitter_cldr'
18
18
  Get a list of all currently supported locales (these are all supported on twitter.com):
19
19
 
20
20
  ```ruby
21
- TwitterCldr.supported_locales # [:af, :ar, :be, :bg, :bn, :ca, ... ]
21
+ TwitterCldr.supported_locales # [:af, :ar, :be, :bg, :bn, :bo, ... ]
22
22
  ```
23
23
 
24
24
  Determine if a locale is supported by TwitterCLDR:
@@ -554,7 +554,7 @@ postal_code.regexp # /(\d{5})(?:[ \-](\d{4}))?/
554
554
  Get a sample of valid postal codes with the `#sample` method:
555
555
 
556
556
  ```ruby
557
- postal_code.sample(5) # ["49037", "77863", "11631-2555", "09849-9066", "60383"]
557
+ postal_code.sample(5) # ["88435-2482", "19400", "34845-8011", "73815-5785", "43520-3829"]
558
558
  ```
559
559
 
560
560
  ### Phone Codes
@@ -1002,6 +1002,22 @@ TwitterCldr::Shared::YAML.dump(["hello", "world"])
1002
1002
  TwitterCldr::Shared::YAML.dump("hello, world")
1003
1003
  ```
1004
1004
 
1005
+ ## Adding New Locales
1006
+
1007
+ TwitterCLDR doesn't support every locale available in the CLDR data set. If the library doesn't support the locale you need, feel free to add it and create a pull request. Adding (or updating) locales is easy. You'll need to run several rake tasks, one with MRI and another with JRuby. You'll also need an internet connection, since most of the tasks require downloading versions of CLDR, ICU, and various Unicode data files.
1008
+
1009
+ Under MRI and then JRuby, run the `add_locale` rake task, passing the locale in the square brackets:
1010
+
1011
+ ```
1012
+ bundle exec rake add_locale[bo]
1013
+ ```
1014
+
1015
+ If you're using rbenv or rvm, try using the `add_locale.sh` script, which will install the required Ruby versions and run the rake tasks:
1016
+
1017
+ ```
1018
+ ./script/add_locale.sh bo
1019
+ ```
1020
+
1005
1021
  ## About Twitter-specific Locales
1006
1022
 
1007
1023
  Twitter tries to always use BCP-47 language codes. Data from the CLDR doesn't always match those codes however, so TwitterCLDR provides a `convert_locale` method to convert between the two. All functionality throughout the entire gem defers to `convert_locale` before retrieving CLDR data. `convert_locale` supports Twitter-supported BCP-47 language codes as well as CLDR locale codes, so you don't have to guess which one to use. Here are a few examples:
data/Rakefile CHANGED
@@ -52,183 +52,100 @@ namespace :spec do
52
52
  end
53
53
 
54
54
  task :update do
55
- tasks = if RUBY_PLATFORM == 'java'
56
- # these should be run using JRuby 1.7 in 1.9 mode, ICU4J v51.2, and CLDR v23.1 (v24 collation rules syntax is not supported yet)
57
- [
58
- "update:tailoring_data", # per locale
59
- "update:collation_tries", # per locale, must come after update:tailoring_data
60
- "update:rbnf_tests", # per locale
61
- "update:transform_tests",
62
- "update:bidi_tests"
63
- ]
64
- else
65
- puts "You might also want to run this rake task using JRuby 1.7 (in 1.9 mode) to update collation data and RBNF tests."
66
-
67
- [
68
- "update:locales_resources", # per locale (+ units resources using different CLDR and ruby-cldr, see LocalesResourcesImporter)
69
- "update:unicode_data",
70
- "update:unicode_properties",
71
- "update:unicode_property_aliases",
72
- "update:generate_casefolder", # must come after unicode data
73
- "update:postal_codes",
74
- "update:phone_codes",
75
- "update:language_codes",
76
- "update:segment_exceptions", # per locale
77
- "update:segment_tests",
78
- "update:readme",
79
- "update:hyphenation"
80
- ]
81
- end
82
-
83
- tasks.each do |task|
84
- puts "Executing #{task}"
85
- Rake::Task[task].invoke
86
- end
55
+ klasses = TwitterCldr::Resources.importer_classes_for_ruby_engine
56
+ TwitterCldr::Resources::ImportResolver.new(klasses).import
87
57
  end
88
58
 
89
- # TODO: 'add_locale' task that creates a new directory and runs all necessary 'update' tasks (+ suggests to run those that depend on JRuby)
59
+ task :add_locale, :locale do |_, args|
60
+ klasses = TwitterCldr::Resources.locale_based_importer_classes_for_ruby_engine
61
+ instances = klasses.map { |klass| klass.new(locales: [args[:locale]]) }
62
+ TwitterCldr::Resources::ImportResolver.new(instances).import
63
+ end
90
64
 
91
- namespace :update do
92
- ICU_JAR = './vendor/icu4j.jar'
65
+ # add_locale and update_locale do the same thing
66
+ task :update_locale, [:locale] => :add_locale
93
67
 
68
+ namespace :update do
94
69
  desc 'Import locales resources'
95
- task :locales_resources, :cldr_path do |_, args|
96
- TwitterCldr::Resources::LocalesResourcesImporter.new(
97
- args[:cldr_path] || './vendor/cldr',
98
- './resources'
99
- ).import
100
- end
101
-
102
- desc 'Import custom locales resources'
103
- task :custom_locales_resources do
104
- TwitterCldr::Resources::CustomLocalesResourcesImporter.new(
105
- './resources/custom/locales'
106
- ).import
70
+ task :locales_resources do
71
+ TwitterCldr::Resources::LocalesResourcesImporter.new.import
107
72
  end
108
73
 
109
74
  desc 'Import tailoring resources from CLDR data (should be executed using JRuby 1.7 in 1.9 mode)'
110
- task :tailoring_data, :cldr_path, :icu4j_jar_path do |_, args|
111
- TwitterCldr::Resources::TailoringImporter.new(
112
- args[:cldr_path] || './vendor/cldr',
113
- './resources/collation/tailoring',
114
- args[:icu4j_jar_path] || ICU_JAR
115
- ).import(TwitterCldr.supported_locales)
75
+ task :tailoring_data do
76
+ TwitterCldr::Resources::TailoringImporter.new.import
116
77
  end
117
78
 
118
79
  desc 'Import Unicode data resources'
119
- task :unicode_data, :unicode_data_path do |_, args|
120
- TwitterCldr::Resources::UnicodeDataImporter.new(
121
- args[:unicode_data_path] || './vendor/unicode-data',
122
- './resources/unicode_data'
123
- ).import
80
+ task :unicode_data do
81
+ TwitterCldr::Resources::UnicodeDataImporter.new.import
124
82
  end
125
83
 
126
84
  desc 'Import Unicode property resources'
127
- task :unicode_properties, :properties_path do |_, args|
128
- TwitterCldr::Resources::Properties::PropertiesImporter.new(
129
- args[:properties_path] || './vendor/unicode-data/properties',
130
- './resources/unicode_data/properties'
131
- ).import
85
+ task :unicode_properties do
86
+ TwitterCldr::Resources::property_importer_classes.each do |klass|
87
+ klass.new.import
88
+ end
132
89
  end
133
90
 
134
91
  desc 'Import unicode property value aliases'
135
- task :unicode_property_aliases, :property_aliases_path do |_, args|
136
- TwitterCldr::Resources::UnicodePropertyAliasesImporter.new(
137
- args[:property_aliases_path] || './vendor/unicode-data',
138
- './resources/unicode_data'
139
- ).import
92
+ task :unicode_property_aliases do
93
+ TwitterCldr::Resources::UnicodePropertyAliasesImporter.new.import
140
94
  end
141
95
 
142
96
  desc 'Generate the casefolder class. Depends on unicode data'
143
- task :generate_casefolder do
144
- TwitterCldr::Resources::CasefolderClassGenerator.new(
145
- './lib/twitter_cldr/resources/casefolder.rb.erb',
146
- './lib/twitter_cldr/shared'
147
- ).generate
97
+ task :casefolder do
98
+ TwitterCldr::Resources::CasefolderClassGenerator.new.import
148
99
  end
149
100
 
150
101
  desc 'Import postal codes resource'
151
102
  task :postal_codes do
152
- TwitterCldr::Resources::PostalCodesImporter.new(
153
- './resources/shared'
154
- ).import
103
+ TwitterCldr::Resources::PostalCodesImporter.new.import
155
104
  end
156
105
 
157
106
  desc 'Import phone codes resource'
158
- task :phone_codes, :cldr_path do |_, args|
159
- TwitterCldr::Resources::PhoneCodesImporter.new(
160
- args[:cldr_path] || './vendor/cldr',
161
- './resources/shared'
162
- ).import
107
+ task :phone_codes do
108
+ TwitterCldr::Resources::PhoneCodesImporter.new.import
163
109
  end
164
110
 
165
111
  desc 'Import language codes'
166
- task :language_codes, :language_codes_data do |_, args|
167
- TwitterCldr::Resources::LanguageCodesImporter.new(
168
- args[:language_codes_data] || './vendor/language-codes',
169
- './resources/shared'
170
- ).import
112
+ task :language_codes do
113
+ TwitterCldr::Resources::LanguageCodesImporter.new.import
171
114
  end
172
115
 
173
116
  desc 'Update default and tailoring tries dumps (should be executed using JRuby 1.7 in 1.9 mode)'
174
117
  task :collation_tries do
175
- TwitterCldr::Resources::CollationTriesDumper.update_dumps
176
- end
177
-
178
- desc 'Import normalization quick check data'
179
- task :normalization_quick_check do
180
- TwitterCldr::Resources::NormalizationQuickCheckImporter.new(
181
- './vendor',
182
- './resources/unicode_data'
183
- ).import
118
+ TwitterCldr::Resources::CollationTriesImporter.new.import
184
119
  end
185
120
 
186
121
  desc 'Import (generate) bidi tests (should be executed using JRuby 1.7 in 1.9 mode)'
187
- task :bidi_tests do |_, args|
188
- TwitterCldr::Resources::BidiTestImporter.new(
189
- './spec/bidi'
190
- ).import
122
+ task :bidi_tests do
123
+ TwitterCldr::Resources::BidiTestImporter.new.import
191
124
  end
192
125
 
193
126
  desc 'Import (generate) rule-based number format tests (should be executed using JRuby 1.7 in 1.9 mode)'
194
- task :rbnf_tests, :icu4j_jar_path do |_, args|
195
- TwitterCldr::Resources::RbnfTestImporter.new(
196
- './spec/formatters/numbers/rbnf/locales',
197
- args[:icu4j_jar_path] || ICU_JAR
198
- ).import(TwitterCldr.supported_locales)
127
+ task :rbnf_tests do
128
+ TwitterCldr::Resources::RbnfTestImporter.new.import
199
129
  end
200
130
 
201
131
  desc 'Import (generate) transformation tests (should be executed using JRuby 1.7 in 1.9 mode)'
202
- task :transform_tests, :icu4j_jar_path do |_, args|
203
- TwitterCldr::Resources::TransformTestImporter.new(
204
- './spec/transforms/test_data.yml',
205
- args[:icu4j_jar_path] || ICU_JAR
206
- ).import
132
+ task :transform_tests do
133
+ TwitterCldr::Resources::TransformTestImporter.new.import
207
134
  end
208
135
 
209
136
  desc 'Import segment exceptions'
210
137
  task :segment_exceptions do
211
- TwitterCldr::Resources::Uli::SegmentExceptionsImporter.new(
212
- './vendor/uli/segments',
213
- './resources/uli/segments'
214
- ).import([:de, :en, :es, :fr, :it, :pt, :ru]) # only locales ULI supports at the moment
138
+ TwitterCldr::Resources::Uli::SegmentExceptionsImporter.new.import
215
139
  end
216
140
 
217
141
  desc 'Import segment tests'
218
142
  task :segment_tests do
219
- TwitterCldr::Resources::SegmentTestsImporter.new(
220
- './vendor/unicode-data/segments',
221
- './resources/shared/segments/tests'
222
- ).import
143
+ TwitterCldr::Resources::SegmentTestsImporter.new.import
223
144
  end
224
145
 
225
146
  desc 'Import hyphenation dictionaries'
226
147
  task :hyphenation_dictionaries do
227
- TwitterCldr::Resources::HyphenationImporter.new(
228
- './vendor/hyphenation/dictionaries',
229
- './resources/shared/hyphenation',
230
- '0d3b5e5314e68c3cf5d573b2e7bdc11143dcb821'
231
- ).import
148
+ TwitterCldr::Resources::HyphenationImporter.new.import
232
149
  end
233
150
 
234
151
  desc 'Update README'
data/lib/twitter_cldr.rb CHANGED
@@ -36,6 +36,9 @@ module TwitterCldr
36
36
  DEFAULT_CALENDAR_TYPE = :gregorian
37
37
 
38
38
  RESOURCES_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'resources')
39
+ VENDOR_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'vendor')
40
+ LIB_DIR = File.dirname(File.expand_path(__FILE__))
41
+ SPEC_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'spec')
39
42
 
40
43
  # TODO: convert this and all other hashes to 1.9 syntax
41
44
  # maps twitter locales to cldr locales
@@ -29,6 +29,10 @@ module TwitterCldr
29
29
  rule_set: "spellout-numbering"
30
30
  }
31
31
 
32
+ def self.supported_locale?(locale)
33
+ TwitterCldr.resource_exists?('locales', locale, 'rbnf')
34
+ end
35
+
32
36
  attr_reader :locale
33
37
 
34
38
  def initialize(locale = TwitterCldr.locale)
@@ -118,7 +122,7 @@ module TwitterCldr
118
122
  end
119
123
 
120
124
  def resource
121
- @resource ||= TwitterCldr.resources.get_locale_resource(locale, "rbnf")[locale][:rbnf][:grouping]
125
+ @resource ||= TwitterCldr.get_locale_resource(locale, "rbnf")[locale][:rbnf][:grouping]
122
126
  end
123
127
 
124
128
  end
@@ -7,11 +7,10 @@ module TwitterCldr
7
7
  module Resources
8
8
  autoload :BidiTestImporter, 'twitter_cldr/resources/bidi_test_importer'
9
9
  autoload :CasefolderClassGenerator, 'twitter_cldr/resources/casefolder_class_generator'
10
- autoload :CollationTriesDumper, 'twitter_cldr/resources/collation_tries_dumper'
11
- autoload :CurrenciesImporter, 'twitter_cldr/resources/currencies_importer'
12
- autoload :CustomLocalesResourcesImporter, 'twitter_cldr/resources/custom_locales_resources_importer'
10
+ autoload :CollationTriesImporter, 'twitter_cldr/resources/collation_tries_importer'
13
11
  autoload :HyphenationImporter, 'twitter_cldr/resources/hyphenation_importer'
14
- autoload :IcuBasedImporter, 'twitter_cldr/resources/icu_based_importer'
12
+ autoload :Importer, 'twitter_cldr/resources/importer'
13
+ autoload :ImportResolver, 'twitter_cldr/resources/import_resolver'
15
14
  autoload :LanguageCodesImporter, 'twitter_cldr/resources/language_codes_importer'
16
15
  autoload :Loader, 'twitter_cldr/resources/loader'
17
16
  autoload :LocalesResourcesImporter, 'twitter_cldr/resources/locales_resources_importer'
@@ -21,12 +20,94 @@ module TwitterCldr
21
20
  autoload :RbnfTestImporter, 'twitter_cldr/resources/rbnf_test_importer'
22
21
  autoload :ReadmeRenderer, 'twitter_cldr/resources/readme_renderer'
23
22
  autoload :RegexpAstGenerator, 'twitter_cldr/resources/regexp_ast_generator'
23
+ autoload :Requirements, 'twitter_cldr/resources/requirements'
24
24
  autoload :SegmentTestsImporter, 'twitter_cldr/resources/segment_tests_importer'
25
25
  autoload :TailoringImporter, 'twitter_cldr/resources/tailoring_importer'
26
26
  autoload :TransformTestImporter, 'twitter_cldr/resources/transform_test_importer'
27
27
  autoload :UnicodeDataImporter, 'twitter_cldr/resources/unicode_data_importer'
28
- autoload :UnicodeImporter, 'twitter_cldr/resources/unicode_importer'
28
+ autoload :UnicodeFileParser, 'twitter_cldr/resources/unicode_file_parser'
29
29
  autoload :UnicodePropertyAliasesImporter, 'twitter_cldr/resources/unicode_property_aliases_importer'
30
30
  autoload :Uli, 'twitter_cldr/resources/uli'
31
+
32
+ class << self
33
+ # these importer class methods aren't constants in order to avoid loading
34
+ # all the classes when the library is required
35
+
36
+ def standard_importer_classes
37
+ @standard_importer_classes ||= [
38
+ BidiTestImporter,
39
+ CasefolderClassGenerator,
40
+ CollationTriesImporter,
41
+ HyphenationImporter,
42
+ LanguageCodesImporter,
43
+ LocalesResourcesImporter,
44
+ PhoneCodesImporter,
45
+ PostalCodesImporter,
46
+ RbnfTestImporter,
47
+ SegmentTestsImporter,
48
+ TailoringImporter,
49
+ TransformTestImporter,
50
+ UnicodeDataImporter,
51
+ UnicodePropertyAliasesImporter,
52
+ ]
53
+ end
54
+
55
+ def uli_importer_classes
56
+ @uli_importer_classes ||= [
57
+ # Disabled for now since ULI TRAC has been down for quite a while.
58
+ # Word is data will eventually be available in a git repo.
59
+ # Uli::SegmentExceptionsImporter
60
+ ]
61
+ end
62
+
63
+ def property_importer_classes
64
+ @property_importer_classes ||= [
65
+ Properties::AgePropertyImporter,
66
+ Properties::ArabicShapingPropertyImporter,
67
+ Properties::BidiBracketsPropertyImporter,
68
+ Properties::BlocksPropertyImporter,
69
+ Properties::DerivedCorePropertiesImporter,
70
+ Properties::EastAsianWidthPropertyImporter,
71
+ Properties::GraphemeBreakPropertyImporter,
72
+ Properties::HangulSyllableTypePropertyImporter,
73
+ Properties::IndicPositionalCategoryPropertyImporter,
74
+ Properties::IndicSyllabicCategoryPropertyImporter,
75
+ Properties::JamoPropertyImporter,
76
+ Properties::LineBreakPropertyImporter,
77
+ Properties::PropListImporter,
78
+ Properties::ScriptExtensionsPropertyImporter,
79
+ Properties::ScriptPropertyImporter,
80
+ Properties::SentenceBreakPropertyImporter,
81
+ Properties::UnicodeDataPropertiesImporter,
82
+ Properties::WordBreakPropertyImporter
83
+ ]
84
+ end
85
+
86
+ def importer_classes
87
+ @importer_classes ||=
88
+ standard_importer_classes +
89
+ uli_importer_classes +
90
+ property_importer_classes
91
+ end
92
+
93
+ def importer_classes_for_ruby_engine
94
+ engine = case RUBY_ENGINE
95
+ when 'ruby' then :mri
96
+ when 'jruby' then :jruby
97
+ else
98
+ raise "Unsupported RUBY_ENGINE '#{RUBY_ENGINE}'"
99
+ end
100
+
101
+ importer_classes.select do |klass|
102
+ klass.default_params[:ruby_engine] == engine
103
+ end
104
+ end
105
+
106
+ def locale_based_importer_classes_for_ruby_engine
107
+ importer_classes_for_ruby_engine.select do |klass|
108
+ !!klass.default_params[:locales]
109
+ end
110
+ end
111
+ end
31
112
  end
32
113
  end
@@ -3,44 +3,50 @@
3
3
  # Copyright 2012 Twitter, Inc
4
4
  # http://www.apache.org/licenses/LICENSE-2.0
5
5
 
6
- require 'java'
7
- java_import "java.lang.Character"
8
- java_import "classpath.Bidi"
9
-
10
- require 'twitter_cldr/resources/download'
11
-
12
6
  module TwitterCldr
13
7
  module Resources
14
8
  # This class should be used with JRuby in 1.9 mode
15
9
 
16
- class BidiTestImporter
17
-
18
- BIDI_TEST_URL = 'http://unicode.org/Public/6.1.0/ucd/BidiTest.txt' # this file is about 3.4 MB
19
- OUT_FILE = "classpath_bidi_test.txt"
10
+ class BidiTestImporter < Importer
11
+ BIDI_TEST_FILE = 'ucd/BidiTest.txt' # this file is about 3.4 MB
12
+ OUT_FILE = 'classpath_bidi_test.txt'
20
13
  DIRECTIONS = [nil, :LTR, :RTL]
21
14
 
22
- def initialize(working_dir)
23
- @working_dir = working_dir
24
- end
15
+ requirement :unicode, '6.1.0', ['ucd/BidiTest.txt']
16
+ output_path File.join(TwitterCldr::SPEC_DIR, 'bidi')
17
+ ruby_engine :jruby
25
18
 
26
- def import
27
- TwitterCldr::Resources.download_if_necessary(File.join(@working_dir, File.basename(BIDI_TEST_URL)), BIDI_TEST_URL)
19
+ def execute
28
20
  generate_test
29
21
  end
30
22
 
31
- protected
23
+ private
24
+
25
+ def before_prepare
26
+ require 'java'
27
+ java_import 'java.lang.Character'
28
+ java_import 'classpath.Bidi'
29
+ end
30
+
31
+ def source_file
32
+ requirements[:unicode].source_path_for(BIDI_TEST_FILE)
33
+ end
34
+
35
+ def output_file
36
+ File.join(params.fetch(:output_path), File.basename(BIDI_TEST_FILE))
37
+ end
32
38
 
33
39
  def generate_test
34
40
  run_hash = {}
35
41
 
36
- File.open(File.join(@working_dir, File.basename(BIDI_TEST_URL)), "r").each_line do |ln|
42
+ File.open(source_file, 'r').each_line do |ln|
37
43
  cur_line = ln.strip
38
44
 
39
45
  case cur_line[0]
40
- when "#", "@"
46
+ when '#', '@'
41
47
  next
42
48
  else
43
- input, bitset = cur_line.split("; ")
49
+ input, bitset = cur_line.split('; ')
44
50
 
45
51
  expand_bitset_str(bitset).each_with_index do |check, index|
46
52
  if check
@@ -48,7 +54,7 @@ module TwitterCldr
48
54
  direction = get_java_direction(DIRECTIONS[index])
49
55
  bidi = Java::Classpath::Bidi.new(types_to_string(types), direction)
50
56
  levels = types.each_with_index.map { |_, idx| bidi.getLevelAt(idx) }
51
- reorder_arr = Java::Classpath::Bidi.reorderVisually(levels.dup, 0, (0...types.size).to_a, 0, types.size)
57
+ reorder_arr = Java::Classpath::Bidi.reorderVisually(levels.dup, 0, (0...types.size).to_a, 0, types.size).to_a
52
58
 
53
59
  key = "#{levels.join(" ")} | #{reorder_arr.join(" ")}"
54
60
  run_hash[key] ||= {}
@@ -59,9 +65,9 @@ module TwitterCldr
59
65
  end
60
66
  end
61
67
 
62
- File.open(File.join(@working_dir, OUT_FILE), "w+") do |out|
68
+ File.open(output_file, 'w+') do |out|
63
69
  run_hash.each_pair do |levels_and_reorders, inputs|
64
- levels, reorders = levels_and_reorders.split(" | ")
70
+ levels, reorders = levels_and_reorders.split(' | ')
65
71
  out.write("@Levels: #{levels}\n")
66
72
  out.write("@Reorder: #{reorders}\n")
67
73
  inputs.each_pair do |input, bitset|
@@ -72,7 +78,7 @@ module TwitterCldr
72
78
  end
73
79
 
74
80
  def expand_bitset_str(bitset)
75
- bitset.to_i.to_s(2).rjust(3, "0").chars.to_a.map { |i| i == "1" }.reverse
81
+ bitset.to_i.to_s(2).rjust(3, '0').chars.to_a.map { |i| i == '1' }.reverse
76
82
  end
77
83
 
78
84
  def get_java_direction(dir)
@@ -88,31 +94,31 @@ module TwitterCldr
88
94
 
89
95
  def types_to_string(types)
90
96
  @utf_map ||= {
91
- "L" => "\u0041",
92
- "LRE" => "\u202a",
93
- "LRO" => "\u202d",
94
- "R" => "\u05be",
95
- "AL" => "\u0626",
96
- "RLE" => "\u202b",
97
- "RLO" => "\u202e",
98
- "PDF" => "\u202c",
99
- "EN" => "\u0030",
100
- "ET" => "\u0023",
101
- "AN" => "\u0667",
102
- "CS" => "\u002c",
103
- "NSM" => "\u0300",
104
- "BN" => "\u0000",
105
- "B" => "\u0085",
106
- "S" => "\u0009",
107
- "WS" => "\u000c",
108
- "ON" => "\u0021"
97
+ 'L' => "\u0041",
98
+ 'LRE' => "\u202a",
99
+ 'LRO' => "\u202d",
100
+ 'R' => "\u05be",
101
+ 'AL' => "\u0626",
102
+ 'RLE' => "\u202b",
103
+ 'RLO' => "\u202e",
104
+ 'PDF' => "\u202c",
105
+ 'EN' => "\u0030",
106
+ 'ET' => "\u0023",
107
+ 'AN' => "\u0667",
108
+ 'CS' => "\u002c",
109
+ 'NSM' => "\u0300",
110
+ 'BN' => "\u0000",
111
+ 'B' => "\u0085",
112
+ 'S' => "\u0009",
113
+ 'WS' => "\u000c",
114
+ 'ON' => "\u0021"
109
115
  }
110
116
 
111
117
  # java 1.6 and 1.7 report different representative characters for the "ES" bidi class
112
- @utf_map["ES"] = (Character.getDirectionality(0x002b) == Character::DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR) ? "\u002b" : "\u002f"
113
- types.inject("") { |ret, type| ret << @utf_map[type]; ret }
118
+ @utf_map['ES'] = (Character.getDirectionality(0x002b) == Character::DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR) ? "\u002b" : "\u002f"
119
+ types.inject('') { |ret, type| ret << @utf_map[type]; ret }
114
120
  end
115
121
 
116
122
  end
117
123
  end
118
- end
124
+ end