when_exe 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. data/bin/irb.rc +1 -0
  2. data/bin/locales.rb +8 -6
  3. data/bin/when.rb +1 -1
  4. data/lib/when_exe.rb +231 -146
  5. data/lib/when_exe/basictypes.rb +108 -18
  6. data/lib/when_exe/calendarnote.rb +263 -116
  7. data/lib/when_exe/calendartypes.rb +413 -22
  8. data/lib/when_exe/coordinates.rb +58 -36
  9. data/lib/when_exe/core/compatibility.rb +8 -6
  10. data/lib/when_exe/core/extension.rb +40 -15
  11. data/lib/when_exe/ephemeris.rb +20 -19
  12. data/lib/when_exe/{region → ephemeris}/moon.rb +4 -4
  13. data/lib/when_exe/{region/ephemeric_notes.rb → ephemeris/notes.rb} +25 -6
  14. data/lib/when_exe/{region → ephemeris}/planets.rb +0 -0
  15. data/lib/when_exe/{region → ephemeris}/sun.rb +7 -3
  16. data/lib/when_exe/{region → ephemeris}/v50.rb +0 -0
  17. data/lib/when_exe/googlecalendar.rb +2 -2
  18. data/lib/when_exe/icalendar.rb +3 -3
  19. data/lib/when_exe/inspect.rb +130 -70
  20. data/lib/when_exe/locales/af.rb +2 -2
  21. data/lib/when_exe/locales/akt.rb +176 -0
  22. data/lib/when_exe/locales/ar.rb +2 -2
  23. data/lib/when_exe/locales/{locales.rb → autoload.rb} +6 -2
  24. data/lib/when_exe/locales/az.rb +2 -2
  25. data/lib/when_exe/locales/bg.rb +2 -2
  26. data/lib/when_exe/locales/bn.rb +2 -2
  27. data/lib/when_exe/locales/bs.rb +2 -2
  28. data/lib/when_exe/locales/ca.rb +2 -2
  29. data/lib/when_exe/locales/cs.rb +2 -2
  30. data/lib/when_exe/locales/cy.rb +2 -2
  31. data/lib/when_exe/locales/da.rb +2 -2
  32. data/lib/when_exe/locales/de.rb +2 -2
  33. data/lib/when_exe/locales/de_AT.rb +2 -2
  34. data/lib/when_exe/locales/de_CH.rb +2 -2
  35. data/lib/when_exe/locales/el.rb +2 -2
  36. data/lib/when_exe/locales/en.rb +2 -2
  37. data/lib/when_exe/locales/en_AU.rb +2 -2
  38. data/lib/when_exe/locales/en_CA.rb +2 -2
  39. data/lib/when_exe/locales/en_GB.rb +2 -2
  40. data/lib/when_exe/locales/en_IE.rb +2 -2
  41. data/lib/when_exe/locales/en_IN.rb +3 -3
  42. data/lib/when_exe/locales/en_NZ.rb +2 -2
  43. data/lib/when_exe/locales/en_US.rb +2 -2
  44. data/lib/when_exe/locales/en_ZA.rb +88 -0
  45. data/lib/when_exe/locales/encoding_conversion.rb +126 -0
  46. data/lib/when_exe/locales/eo.rb +2 -2
  47. data/lib/when_exe/locales/es.rb +2 -2
  48. data/lib/when_exe/locales/es_419.rb +2 -2
  49. data/lib/when_exe/locales/es_AR.rb +2 -2
  50. data/lib/when_exe/locales/es_CL.rb +2 -2
  51. data/lib/when_exe/locales/es_CO.rb +2 -2
  52. data/lib/when_exe/locales/es_CR.rb +2 -2
  53. data/lib/when_exe/locales/es_EC.rb +2 -2
  54. data/lib/when_exe/locales/es_MX.rb +2 -2
  55. data/lib/when_exe/locales/es_PA.rb +2 -2
  56. data/lib/when_exe/locales/es_PE.rb +2 -2
  57. data/lib/when_exe/locales/es_US.rb +84 -0
  58. data/lib/when_exe/locales/es_VE.rb +2 -2
  59. data/lib/when_exe/locales/et.rb +2 -2
  60. data/lib/when_exe/locales/eu.rb +2 -2
  61. data/lib/when_exe/locales/fa.rb +2 -2
  62. data/lib/when_exe/locales/fi.rb +3 -3
  63. data/lib/when_exe/locales/fr.rb +2 -2
  64. data/lib/when_exe/locales/fr_CA.rb +2 -2
  65. data/lib/when_exe/locales/fr_CH.rb +2 -2
  66. data/lib/when_exe/locales/gl.rb +2 -2
  67. data/lib/when_exe/locales/he.rb +3 -3
  68. data/lib/when_exe/locales/hi.rb +2 -2
  69. data/lib/when_exe/locales/hi_IN.rb +2 -2
  70. data/lib/when_exe/locales/hr.rb +2 -2
  71. data/lib/when_exe/locales/hu.rb +6 -5
  72. data/lib/when_exe/locales/iast.rb +90 -0
  73. data/lib/when_exe/locales/id.rb +2 -2
  74. data/lib/when_exe/locales/is.rb +2 -2
  75. data/lib/when_exe/locales/it.rb +2 -2
  76. data/lib/when_exe/locales/it_CH.rb +2 -2
  77. data/lib/when_exe/locales/ja.rb +2 -2
  78. data/lib/when_exe/locales/kn.rb +2 -2
  79. data/lib/when_exe/locales/ko.rb +2 -2
  80. data/lib/when_exe/locales/links.rb +3 -3
  81. data/lib/when_exe/locales/lo.rb +2 -2
  82. data/lib/when_exe/{parts → locales}/locale.rb +77 -49
  83. data/lib/when_exe/locales/lt.rb +6 -2
  84. data/lib/when_exe/locales/lv.rb +2 -2
  85. data/lib/when_exe/locales/mk.rb +2 -2
  86. data/lib/when_exe/locales/mn.rb +2 -2
  87. data/lib/when_exe/locales/ms.rb +2 -2
  88. data/lib/when_exe/locales/nb.rb +2 -2
  89. data/lib/when_exe/locales/ne.rb +2 -2
  90. data/lib/when_exe/locales/nl.rb +2 -2
  91. data/lib/when_exe/locales/nn.rb +2 -2
  92. data/lib/when_exe/locales/or.rb +2 -2
  93. data/lib/when_exe/locales/pl.rb +2 -2
  94. data/lib/when_exe/locales/pt.rb +2 -2
  95. data/lib/when_exe/locales/pt_BR.rb +2 -2
  96. data/lib/when_exe/locales/rm.rb +2 -2
  97. data/lib/when_exe/locales/ro.rb +2 -2
  98. data/lib/when_exe/locales/ru.rb +2 -2
  99. data/lib/when_exe/locales/sk.rb +2 -2
  100. data/lib/when_exe/locales/sl.rb +2 -2
  101. data/lib/when_exe/locales/sr.rb +2 -2
  102. data/lib/when_exe/locales/sv.rb +2 -2
  103. data/lib/when_exe/locales/sw.rb +2 -2
  104. data/lib/when_exe/locales/ta.rb +95 -0
  105. data/lib/when_exe/locales/th.rb +2 -2
  106. data/lib/when_exe/locales/tl.rb +3 -3
  107. data/lib/when_exe/locales/tr.rb +2 -2
  108. data/lib/when_exe/locales/transliteration_table.rb +62 -0
  109. data/lib/when_exe/locales/uk.rb +15 -15
  110. data/lib/when_exe/locales/ur.rb +2 -2
  111. data/lib/when_exe/locales/uz.rb +2 -2
  112. data/lib/when_exe/locales/vi.rb +2 -2
  113. data/lib/when_exe/locales/wo.rb +2 -2
  114. data/lib/when_exe/locales/zh_CN.rb +2 -2
  115. data/lib/when_exe/locales/zh_HK.rb +15 -15
  116. data/lib/when_exe/locales/zh_TW.rb +2 -2
  117. data/lib/when_exe/locales/zh_YUE.rb +77 -0
  118. data/lib/when_exe/mini_application.rb +22 -12
  119. data/lib/when_exe/parts/geometric_complex.rb +16 -1
  120. data/lib/when_exe/parts/method_cash.rb +184 -238
  121. data/lib/when_exe/parts/resource.rb +65 -16
  122. data/lib/when_exe/region/armenian.rb +56 -0
  123. data/lib/when_exe/region/bahai.rb +13 -13
  124. data/lib/when_exe/region/balinese.rb +33 -35
  125. data/lib/when_exe/region/chinese.rb +82 -78
  126. data/lib/when_exe/region/{chinese_calendar.rb → chinese/calendars.rb} +59 -40
  127. data/lib/when_exe/region/{chinese_epoch.rb → chinese/epochs.rb} +3 -4
  128. data/lib/when_exe/region/{chinese_twin.rb → chinese/twins.rb} +48 -51
  129. data/lib/when_exe/region/christian.rb +236 -127
  130. data/lib/when_exe/region/coptic.rb +9 -10
  131. data/lib/when_exe/region/dee.rb +48 -0
  132. data/lib/when_exe/region/discordian.rb +225 -0
  133. data/lib/when_exe/region/far_east.rb +2 -6
  134. data/lib/when_exe/region/french.rb +7 -17
  135. data/lib/when_exe/region/geologicalage.rb +0 -1
  136. data/lib/when_exe/region/goddess.rb +58 -0
  137. data/lib/when_exe/region/indian.rb +323 -231
  138. data/lib/when_exe/region/iranian.rb +159 -22
  139. data/lib/when_exe/region/islamic.rb +7 -9
  140. data/lib/when_exe/region/japanese.rb +14 -803
  141. data/lib/when_exe/region/japanese/calendars.rb +397 -0
  142. data/lib/when_exe/region/japanese/epochs.rb +426 -0
  143. data/lib/when_exe/region/{nihon_shoki.rb → japanese/nihon_shoki.rb} +0 -2
  144. data/lib/when_exe/region/{japanese_notes.rb → japanese/notes.rb} +179 -150
  145. data/lib/when_exe/region/japanese/residues.rb +1306 -0
  146. data/lib/when_exe/region/{japanese_twin.rb → japanese/twins.rb} +12 -15
  147. data/lib/when_exe/region/javanese.rb +16 -14
  148. data/lib/when_exe/region/jewish.rb +8 -9
  149. data/lib/when_exe/region/korean.rb +146 -35
  150. data/lib/when_exe/region/m17n.rb +8 -10
  151. data/lib/when_exe/region/martian.rb +44 -16
  152. data/lib/when_exe/region/mayan.rb +12 -10
  153. data/lib/when_exe/region/pope.rb +0 -1
  154. data/lib/when_exe/region/residue.rb +4 -5
  155. data/lib/when_exe/region/roman.rb +20 -24
  156. data/lib/when_exe/region/ryukyu.rb +3 -4
  157. data/lib/when_exe/region/shire.rb +97 -94
  158. data/lib/when_exe/region/symmetry.rb +50 -0
  159. data/lib/when_exe/region/thai.rb +164 -56
  160. data/lib/when_exe/region/tibetan.rb +86 -86
  161. data/lib/when_exe/region/vietnamese.rb +9 -12
  162. data/lib/when_exe/region/weekdate.rb +80 -0
  163. data/lib/when_exe/region/world.rb +65 -70
  164. data/lib/when_exe/region/yerm.rb +98 -0
  165. data/lib/when_exe/region/zoroastrian.rb +203 -0
  166. data/lib/when_exe/timestandard.rb +4 -4
  167. data/lib/when_exe/tmobjects.rb +1 -3
  168. data/lib/when_exe/tmposition.rb +13 -12
  169. data/lib/when_exe/tmreference.rb +11 -10
  170. data/lib/when_exe/version.rb +1 -1
  171. data/link_to_online_documents +3 -3
  172. data/test/examples/Residue.m17n +1 -1
  173. data/test/examples/Terms.m17n +1 -1
  174. data/test/test.rb +2 -1
  175. data/test/test/basictypes.rb +18 -2
  176. data/test/test/calendarnote.rb +1 -1
  177. data/test/test/calendartypes.rb +1 -1
  178. data/test/test/coordinates.rb +7 -7
  179. data/test/test/{region → ephemeris}/moon.rb +0 -0
  180. data/test/test/{region → ephemeris}/planets.rb +0 -0
  181. data/test/test/{region → ephemeris}/sun.rb +0 -0
  182. data/test/test/parts.rb +8 -13
  183. data/test/test/region/christian.rb +245 -0
  184. data/test/test/region/french.rb +16 -16
  185. data/test/test/region/iran.rb +34 -34
  186. data/test/test/region/japanese.rb +6 -4
  187. data/test/test/region/m17n.rb +8 -7
  188. data/test/test/region/mayan.rb +12 -12
  189. data/test/test/region/residue.rb +20 -4
  190. data/test/test/region/thai.rb +25 -3
  191. data/test/test/region/yerm.rb +146 -0
  192. metadata +39 -20
  193. data/lib/when_exe/region/japanese_residues.rb +0 -1212
  194. data/test/test/region/civil.rb +0 -124
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ar.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
  autoload :Locale_af, 'when_exe/locales/af'
11
11
  autoload :Locale_ar, 'when_exe/locales/ar'
12
12
  autoload :Locale_az, 'when_exe/locales/az'
@@ -28,6 +28,7 @@ module When::BasicTypes
28
28
  autoload :Locale_en_IN, 'when_exe/locales/en_IN'
29
29
  autoload :Locale_en_NZ, 'when_exe/locales/en_NZ'
30
30
  autoload :Locale_en_US, 'when_exe/locales/en_US'
31
+ autoload :Locale_en_ZA, 'when_exe/locales/en_ZA'
31
32
  autoload :Locale_en, 'when_exe/locales/en'
32
33
  autoload :Locale_eo, 'when_exe/locales/eo'
33
34
  autoload :Locale_es_419, 'when_exe/locales/es_419'
@@ -39,6 +40,7 @@ module When::BasicTypes
39
40
  autoload :Locale_es_MX, 'when_exe/locales/es_MX'
40
41
  autoload :Locale_es_PA, 'when_exe/locales/es_PA'
41
42
  autoload :Locale_es_PE, 'when_exe/locales/es_PE'
43
+ autoload :Locale_es_US, 'when_exe/locales/es_US'
42
44
  autoload :Locale_es_VE, 'when_exe/locales/es_VE'
43
45
  autoload :Locale_es, 'when_exe/locales/es'
44
46
  autoload :Locale_et, 'when_exe/locales/et'
@@ -83,6 +85,7 @@ module When::BasicTypes
83
85
  autoload :Locale_sr, 'when_exe/locales/sr'
84
86
  autoload :Locale_sv, 'when_exe/locales/sv'
85
87
  autoload :Locale_sw, 'when_exe/locales/sw'
88
+ autoload :Locale_ta, 'when_exe/locales/ta'
86
89
  autoload :Locale_th, 'when_exe/locales/th'
87
90
  autoload :Locale_tl, 'when_exe/locales/tl'
88
91
  autoload :Locale_tr, 'when_exe/locales/tr'
@@ -94,5 +97,6 @@ module When::BasicTypes
94
97
  autoload :Locale_zh_CN, 'when_exe/locales/zh_CN'
95
98
  autoload :Locale_zh_HK, 'when_exe/locales/zh_HK'
96
99
  autoload :Locale_zh_TW, 'when_exe/locales/zh_TW'
100
+ autoload :Locale_zh_YUE, 'when_exe/locales/zh_YUE'
97
101
  end
98
102
  end
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/az.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/bg.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/bn.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/bs.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ca.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/cs.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/cy.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/da.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/de.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/de-AT.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/de-CH.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/el.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-AU.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-CA.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-GB.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-IE.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-IN.yml
12
12
 
@@ -35,7 +35,7 @@ module When::BasicTypes
35
35
  "Thursday",
36
36
  "Friday",
37
37
  "Saturday"],
38
- "formats"=>{"default"=>"%Y-%m-%d", "long"=>"%B %d, %Y", "short"=>"%b %d"},
38
+ "formats"=>{"default"=>"%d-%m-%Y", "long"=>"%B %d, %Y", "short"=>"%b %d"},
39
39
  "month_names"=>
40
40
  [nil,
41
41
  "January",
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-NZ.yml
12
12
 
@@ -5,8 +5,8 @@
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
7
7
 
8
- module When::BasicTypes
9
- class M17n
8
+ module When
9
+ module Locale
10
10
 
11
11
  # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-US.yml
12
12
 
@@ -0,0 +1,88 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2012-2014 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
+ =end
7
+
8
+ module When
9
+ module Locale
10
+
11
+ # from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en-ZA.yml
12
+
13
+ Locale_en_ZA =
14
+ {"date"=>
15
+ {"abbr_day_names"=>["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
16
+ "abbr_month_names"=>
17
+ [nil,
18
+ "Jan",
19
+ "Feb",
20
+ "Mar",
21
+ "Apr",
22
+ "May",
23
+ "Jun",
24
+ "Jul",
25
+ "Aug",
26
+ "Sep",
27
+ "Oct",
28
+ "Nov",
29
+ "Dec"],
30
+ "day_names"=>
31
+ ["Sunday",
32
+ "Monday",
33
+ "Tuesday",
34
+ "Wednesday",
35
+ "Thursday",
36
+ "Friday",
37
+ "Saturday"],
38
+ "formats"=>{"default"=>"%Y-%m-%d", "long"=>"%B %d, %Y", "short"=>"%b %d"},
39
+ "month_names"=>
40
+ [nil,
41
+ "January",
42
+ "February",
43
+ "March",
44
+ "April",
45
+ "May",
46
+ "June",
47
+ "July",
48
+ "August",
49
+ "September",
50
+ "October",
51
+ "November",
52
+ "December"],
53
+ "order"=>[:year, :month, :day]},
54
+ "time"=>
55
+ {"am"=>"am",
56
+ "formats"=>
57
+ {"default"=>"%a, %d %b %Y %H:%M:%S %z",
58
+ "long"=>"%B %d, %Y %H:%M",
59
+ "short"=>"%d %b %H:%M",
60
+ "time"=>"%H:%M:%S %z"},
61
+ "pm"=>"pm"},
62
+ "datetime"=>
63
+ {"distance_in_words"=>
64
+ {"about_x_hours"=>{"one"=>"about 1 hour", "other"=>"about %{count} hours"},
65
+ "about_x_months"=>
66
+ {"one"=>"about 1 month", "other"=>"about %{count} months"},
67
+ "about_x_years"=>{"one"=>"about 1 year", "other"=>"about %{count} years"},
68
+ "almost_x_years"=>
69
+ {"one"=>"almost 1 year", "other"=>"almost %{count} years"},
70
+ "half_a_minute"=>"half a minute",
71
+ "less_than_x_minutes"=>
72
+ {"one"=>"less than a minute", "other"=>"less than %{count} minutes"},
73
+ "less_than_x_seconds"=>
74
+ {"one"=>"less than 1 second", "other"=>"less than %{count} seconds"},
75
+ "over_x_years"=>{"one"=>"over 1 year", "other"=>"over %{count} years"},
76
+ "x_days"=>{"one"=>"1 day", "other"=>"%{count} days"},
77
+ "x_minutes"=>{"one"=>"1 minute", "other"=>"%{count} minutes"},
78
+ "x_months"=>{"one"=>"1 month", "other"=>"%{count} months"},
79
+ "x_seconds"=>{"one"=>"1 second", "other"=>"%{count} seconds"}},
80
+ "prompts"=>
81
+ {"day"=>"Day",
82
+ "hour"=>"Hour",
83
+ "minute"=>"Minute",
84
+ "month"=>"Month",
85
+ "second"=>"Seconds",
86
+ "year"=>"Year"}}}
87
+ end
88
+ end
@@ -0,0 +1,126 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2014 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
+ =end
7
+
8
+ module When
9
+
10
+ #
11
+ # エンコーディングの変換
12
+ #
13
+ module EncodingConversion
14
+
15
+ class << self
16
+ if String.method_defined?(:encode)
17
+ #
18
+ # 内部エンコーディング文字列化
19
+ #
20
+ # @param [Object] source もとにする Object
21
+ #
22
+ # @return [Object] 内部エンコーディング化した Object
23
+ #
24
+ # @private
25
+ def to_internal_encoding(source)
26
+ default_internal = Encoding.default_internal||'UTF-8'
27
+ case source
28
+ when Locale ; source.to_internal_encoding
29
+ when String ; (source.encoding == default_internal) ?
30
+ source :
31
+ source.encode(default_internal)
32
+ when Regexp ; (source.encoding == default_internal) ?
33
+ source :
34
+ Regexp.new(source.to_s.encode(default_internal))
35
+ when Array ; source.map {|e| to_internal_encoding(e)}
36
+ when Hash
37
+ hash = {}
38
+ source.each_pair do |key, value|
39
+ hash[to_internal_encoding(key)] = to_internal_encoding(value)
40
+ end
41
+ hash
42
+ else ; source.respond_to?(:to_internal_encoding) ? source.to_internal_encoding : source
43
+ end
44
+ end
45
+
46
+ #
47
+ # 外部エンコーディング文字列化
48
+ #
49
+ # @param [Object] source もとにする Object
50
+ #
51
+ # @return [Object] 外部エンコーディング化した Object
52
+ #
53
+ # @private
54
+ def to_external_encoding(source)
55
+ default_external = Encoding.default_external
56
+ case source
57
+ when Locale ; source.to_external_encoding
58
+ when String ; (source.encoding == default_external) ?
59
+ source :
60
+ source.encode(default_external)
61
+ when Regexp ; (source.encoding == default_external) ?
62
+ source :
63
+ Regexp.new(source.to_s.encode(default_external))
64
+ when Array ; source.map {|e| to_external_encoding(e)}
65
+ when Hash
66
+ hash = {}
67
+ source.each_pair do |key, value|
68
+ hash[to_external_encoding(key)] = to_external_encoding(value)
69
+ end
70
+ hash
71
+ else ; source.respond_to?(:to_external_encoding) ? source.to_external_encoding : source
72
+ end
73
+ end
74
+
75
+ else
76
+ # 内部エンコーディング文字列化(ダミー)
77
+ #
78
+ # @param [String] string もとにする String または M17n
79
+ #
80
+ # @return [String] そのまま返す
81
+ #
82
+ def to_internal_encoding(string)
83
+ string
84
+ end
85
+ #
86
+ # 外部エンコーディング文字列化(ダミー)
87
+ #
88
+ # @param [String] string もとにする String または M17n
89
+ #
90
+ # @return [String] そのまま返す
91
+ #
92
+ def to_external_encoding(string)
93
+ string
94
+ end
95
+ end
96
+ end
97
+
98
+ #
99
+ # 内部エンコーディング文字列化
100
+ #
101
+ def to_internal_encoding
102
+ EncodingConversion.to_internal_encoding(self)
103
+ end
104
+
105
+ #
106
+ # 外部エンコーディング文字列化
107
+ #
108
+ def to_external_encoding
109
+ EncodingConversion.to_external_encoding(self)
110
+ end
111
+
112
+ #
113
+ # 内部エンコーディング文字列化(単項)
114
+ #
115
+ def +@
116
+ to_internal_encoding
117
+ end
118
+
119
+ #
120
+ # 外部エンコーディング文字列化(単項)
121
+ #
122
+ def -@
123
+ to_external_encoding
124
+ end
125
+ end
126
+ end