when_exe 0.2.100 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.ja.txt +25 -25
- data/LICENSE.txt +31 -31
- data/bin/irb.rc +5 -0
- data/bin/locales.rb +2 -2
- data/bin/when.rb +16 -0
- data/bin/when.rb.config +7 -0
- data/lib/when_exe.rb +616 -14
- data/lib/when_exe/basictypes.rb +615 -0
- data/lib/when_exe/calendartypes.rb +1700 -0
- data/lib/when_exe/coordinates.rb +1936 -0
- data/lib/when_exe/core/compatibility.rb +54 -0
- data/lib/when_exe/core/duration.rb +72 -72
- data/lib/when_exe/core/extension.rb +382 -0
- data/lib/when_exe/ephemeris.rb +1845 -0
- data/lib/when_exe/googlecalendar.rb +140 -0
- data/lib/when_exe/icalendar.rb +1587 -0
- data/lib/when_exe/inspect.rb +1237 -0
- data/lib/when_exe/locales/af.rb +90 -0
- data/lib/when_exe/locales/ar.rb +145 -0
- data/lib/when_exe/locales/az.rb +90 -0
- data/lib/when_exe/locales/bg.rb +90 -0
- data/lib/when_exe/locales/bn.rb +94 -0
- data/lib/when_exe/locales/bs.rb +121 -0
- data/lib/when_exe/locales/ca.rb +92 -0
- data/lib/when_exe/locales/cs.rb +107 -0
- data/lib/when_exe/locales/cy.rb +150 -0
- data/lib/when_exe/locales/da.rb +84 -0
- data/lib/when_exe/locales/de.rb +92 -0
- data/lib/when_exe/locales/de_AT.rb +92 -0
- data/lib/when_exe/locales/de_CH.rb +92 -0
- data/lib/when_exe/locales/el.rb +93 -0
- data/lib/when_exe/locales/en.rb +88 -0
- data/lib/when_exe/locales/en_AU.rb +88 -0
- data/lib/when_exe/locales/en_CA.rb +88 -0
- data/lib/when_exe/locales/en_GB.rb +88 -0
- data/lib/when_exe/locales/en_IN.rb +88 -0
- data/lib/when_exe/locales/en_NZ.rb +88 -0
- data/lib/when_exe/locales/eo.rb +89 -0
- data/lib/when_exe/locales/es.rb +84 -0
- data/lib/when_exe/locales/es_419.rb +84 -0
- data/lib/when_exe/locales/es_AR.rb +84 -0
- data/lib/when_exe/locales/es_CL.rb +84 -0
- data/lib/when_exe/locales/es_CO.rb +84 -0
- data/lib/when_exe/locales/es_MX.rb +84 -0
- data/lib/when_exe/locales/es_PE.rb +85 -0
- data/lib/when_exe/locales/es_VE.rb +84 -0
- data/lib/when_exe/locales/et.rb +94 -0
- data/lib/when_exe/locales/eu.rb +95 -0
- data/lib/when_exe/locales/fa.rb +80 -0
- data/lib/when_exe/locales/fi.rb +89 -0
- data/lib/when_exe/locales/fr.rb +88 -0
- data/lib/when_exe/locales/fr_CA.rb +88 -0
- data/lib/when_exe/locales/fr_CH.rb +88 -0
- data/lib/when_exe/locales/gl.rb +81 -0
- data/lib/when_exe/locales/he.rb +84 -0
- data/lib/when_exe/locales/hi.rb +80 -0
- data/lib/when_exe/locales/hi_IN.rb +84 -0
- data/lib/when_exe/locales/hr.rb +128 -0
- data/lib/when_exe/locales/hu.rb +84 -0
- data/lib/when_exe/locales/id.rb +89 -0
- data/lib/when_exe/locales/is.rb +89 -0
- data/lib/when_exe/locales/it.rb +87 -0
- data/lib/when_exe/locales/it_CH.rb +87 -0
- data/lib/when_exe/locales/ja.rb +78 -0
- data/lib/when_exe/locales/kn.rb +86 -0
- data/lib/when_exe/locales/ko.rb +78 -0
- data/lib/when_exe/locales/links.rb +2342 -0
- data/lib/when_exe/locales/lo.rb +123 -0
- data/lib/when_exe/locales/locales.rb +91 -0
- data/lib/when_exe/locales/lt.rb +111 -0
- data/lib/when_exe/locales/lv.rb +118 -0
- data/lib/when_exe/locales/mk.rb +93 -0
- data/lib/when_exe/locales/mn.rb +80 -0
- data/lib/when_exe/locales/nb.rb +81 -0
- data/lib/when_exe/locales/ne.rb +81 -0
- data/lib/when_exe/locales/nl.rb +92 -0
- data/lib/when_exe/locales/nn.rb +73 -0
- data/lib/when_exe/locales/or.rb +84 -0
- data/lib/when_exe/locales/pl.rb +128 -0
- data/lib/when_exe/locales/pt.rb +88 -0
- data/lib/when_exe/locales/pt_BR.rb +88 -0
- data/lib/when_exe/locales/rm.rb +143 -0
- data/lib/when_exe/locales/ro.rb +105 -0
- data/lib/when_exe/locales/ru.rb +128 -0
- data/lib/when_exe/locales/sk.rb +109 -0
- data/lib/when_exe/locales/sl.rb +122 -0
- data/lib/when_exe/locales/sr.rb +122 -0
- data/lib/when_exe/locales/sv.rb +83 -0
- data/lib/when_exe/locales/sw.rb +89 -0
- data/lib/when_exe/locales/th.rb +78 -0
- data/lib/when_exe/locales/tl.rb +99 -0
- data/lib/when_exe/locales/tr.rb +96 -0
- data/lib/when_exe/locales/uk.rb +128 -0
- data/lib/when_exe/locales/uz.rb +128 -0
- data/lib/when_exe/locales/vi.rb +94 -0
- data/lib/when_exe/locales/wo.rb +82 -0
- data/lib/when_exe/locales/zh_CN.rb +77 -0
- data/lib/when_exe/locales/zh_HK.rb +77 -0
- data/lib/when_exe/locales/zh_TW.rb +77 -0
- data/lib/when_exe/mini_application.rb +252 -0
- data/lib/when_exe/parts/enumerator.rb +472 -0
- data/lib/when_exe/parts/geometric_complex.rb +379 -0
- data/lib/when_exe/parts/locale.rb +513 -0
- data/lib/when_exe/parts/method_cash.rb +207 -0
- data/lib/when_exe/parts/resource.rb +806 -0
- data/lib/when_exe/parts/timezone.rb +182 -0
- data/lib/when_exe/region/bahai.rb +145 -0
- data/lib/when_exe/region/balinese.rb +627 -0
- data/lib/when_exe/region/chinese.rb +896 -0
- data/lib/when_exe/region/chinese_calendar.rb +919 -0
- data/lib/when_exe/region/chinese_epoch.rb +1245 -0
- data/lib/when_exe/region/christian.rb +644 -0
- data/lib/when_exe/region/far_east.rb +192 -0
- data/lib/when_exe/region/french.rb +66 -0
- data/lib/when_exe/region/geologicalage.rb +639 -0
- data/lib/when_exe/region/indian.rb +1066 -0
- data/lib/when_exe/region/iranian.rb +66 -0
- data/lib/when_exe/region/islamic.rb +105 -0
- data/lib/when_exe/region/japanese.rb +851 -0
- data/lib/when_exe/region/japanese_notes.rb +964 -0
- data/lib/when_exe/region/japanese_residues.rb +1149 -0
- data/lib/when_exe/region/javanese.rb +228 -0
- data/lib/when_exe/region/jewish.rb +127 -0
- data/lib/when_exe/region/korean.rb +267 -0
- data/lib/when_exe/region/m17n.rb +115 -0
- data/lib/when_exe/region/martian.rb +215 -0
- data/lib/when_exe/region/mayan.rb +122 -0
- data/lib/when_exe/region/moon.rb +333 -0
- data/lib/when_exe/region/nihon_shoki.rb +73 -0
- data/lib/when_exe/region/planets.rb +585 -0
- data/lib/when_exe/region/pope.rb +298 -0
- data/lib/when_exe/region/residue.rb +229 -0
- data/lib/when_exe/region/roman.rb +325 -0
- data/lib/when_exe/region/ryukyu.rb +98 -0
- data/lib/when_exe/region/shire.rb +254 -0
- data/lib/when_exe/region/sun.rb +210 -0
- data/lib/when_exe/region/thai.rb +227 -0
- data/lib/when_exe/region/tibetan.rb +233 -0
- data/lib/when_exe/region/v50.rb +111 -0
- data/lib/when_exe/region/vietnamese.rb +173 -0
- data/lib/when_exe/region/world.rb +197 -0
- data/lib/when_exe/timestandard.rb +547 -0
- data/lib/when_exe/tmduration.rb +330 -330
- data/lib/when_exe/tmobjects.rb +1295 -0
- data/lib/when_exe/tmposition.rb +1955 -0
- data/lib/when_exe/tmreference.rb +1547 -0
- data/lib/when_exe/version.rb +10 -3
- data/link_to_online_documents +4 -0
- data/test/examples/JapanHolidays.ics +456 -0
- data/test/examples/Millennium.ics +17 -0
- data/test/examples/NewYork.ics +61 -0
- data/test/examples/Residue.m17n +135 -0
- data/test/examples/Spatial.m17n +179 -0
- data/test/examples/Terms.m17n +39 -0
- data/test/examples/Test.ics +53 -0
- data/test/examples/USA-DST.ics +61 -0
- data/test/examples/geometric_complex.rb +41 -0
- data/test/examples/sample.xml +14 -0
- data/test/examples/today.rb +61 -0
- data/test/test.rb +54 -19
- data/test/test.rb.config +1 -0
- data/test/test/basictypes.rb +368 -0
- data/test/test/calendartypes.rb +57 -0
- data/test/test/coordinates.rb +380 -0
- data/test/test/ephemeris.rb +127 -0
- data/test/test/googlecalendar.rb +167 -0
- data/test/test/icalendar.rb +848 -0
- data/test/test/inspect.rb +115 -0
- data/test/test/parts.rb +480 -0
- data/test/test/region/chinese.rb +161 -0
- data/test/test/region/french.rb +33 -0
- data/test/test/region/geologicalage.rb +14 -0
- data/test/test/region/indian.rb +55 -0
- data/test/test/region/iran.rb +54 -0
- data/test/test/region/islamic.rb +18 -0
- data/test/test/region/japanese.rb +62 -0
- data/test/test/region/jewish.rb +61 -0
- data/test/test/region/m17n.rb +181 -0
- data/test/test/region/mayan.rb +78 -0
- data/test/test/region/moon.rb +14 -0
- data/test/test/region/planets.rb +14 -0
- data/test/test/region/residue.rb +123 -0
- data/test/test/region/sun.rb +14 -0
- data/test/test/region/thai.rb +94 -0
- data/test/test/region/tibetan.rb +30 -0
- data/test/test/tmobjects.rb +356 -57
- data/test/test/tmposition.rb +237 -0
- data/test/test/tmreference.rb +95 -0
- data/when_exe.gemspec +2 -2
- metadata +187 -7
- data/doc/COPYING +0 -31
- data/doc/COPYING.ja +0 -25
- data/doc/document_url +0 -1
@@ -0,0 +1,82 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
Copyright (C) 2012-2013 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::BasicTypes
|
9
|
+
class M17n
|
10
|
+
|
11
|
+
# from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/wo.yml
|
12
|
+
|
13
|
+
Locale_wo =
|
14
|
+
{"date"=>
|
15
|
+
{"abbr_day_names"=>["Dib", "Alt", "Tal", "All", "Alx", "Ajj", "Gaw"],
|
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
|
+
["Dibèer", "Altine", "Talaata", "Allarba", "Alxamess", "Ajjouma", "Gaawu"],
|
32
|
+
"formats"=>{"default"=>"%Y-%m-%d", "long"=>"%B %d, %Y", "short"=>"%b %d"},
|
33
|
+
"month_names"=>
|
34
|
+
[nil,
|
35
|
+
"Tamkharit",
|
36
|
+
"Digui Gamou",
|
37
|
+
"Gamou",
|
38
|
+
"Raki Gamou",
|
39
|
+
"Rakati Gamou",
|
40
|
+
"Mamou Kor",
|
41
|
+
"Ndeyou Kor",
|
42
|
+
"Baraxlou",
|
43
|
+
"Kor",
|
44
|
+
"Kori",
|
45
|
+
"Digui Tabaski",
|
46
|
+
"Tabaski"],
|
47
|
+
"order"=>[:year, :month, :day]},
|
48
|
+
"time"=>
|
49
|
+
{"am"=>"am",
|
50
|
+
"formats"=>
|
51
|
+
{"default"=>"%a, %d %b %Y %H:%M:%S %z",
|
52
|
+
"long"=>"%B %d, %Y %H:%M",
|
53
|
+
"short"=>"%d %b %H:%M",
|
54
|
+
"time"=>"%H:%M:%S %z"},
|
55
|
+
"pm"=>"pm"},
|
56
|
+
"datetime"=>
|
57
|
+
{"distance_in_words"=>
|
58
|
+
{"about_x_hours"=>{"one"=>"about 1 hour", "other"=>"about %{count} hours"},
|
59
|
+
"about_x_months"=>
|
60
|
+
{"one"=>"about 1 month", "other"=>"about %{count} months"},
|
61
|
+
"about_x_years"=>{"one"=>"about 1 year", "other"=>"about %{count} years"},
|
62
|
+
"almost_x_years"=>
|
63
|
+
{"one"=>"almost 1 year", "other"=>"almost %{count} years"},
|
64
|
+
"half_a_minute"=>"half a minute",
|
65
|
+
"less_than_x_minutes"=>
|
66
|
+
{"one"=>"less than a minute", "other"=>"less than %{count} minutes"},
|
67
|
+
"less_than_x_seconds"=>
|
68
|
+
{"one"=>"less than 1 second", "other"=>"less than %{count} seconds"},
|
69
|
+
"over_x_years"=>{"one"=>"over 1 year", "other"=>"over %{count} years"},
|
70
|
+
"x_days"=>{"one"=>"1 day", "other"=>"%{count} days"},
|
71
|
+
"x_minutes"=>{"one"=>"1 minute", "other"=>"%{count} minutes"},
|
72
|
+
"x_months"=>{"one"=>"1 month", "other"=>"%{count} months"},
|
73
|
+
"x_seconds"=>{"one"=>"1 second", "other"=>"%{count} seconds"}},
|
74
|
+
"prompts"=>
|
75
|
+
{"day"=>"Day",
|
76
|
+
"hour"=>"Hour",
|
77
|
+
"minute"=>"Minute",
|
78
|
+
"month"=>"Month",
|
79
|
+
"second"=>"Seconds",
|
80
|
+
"year"=>"Year"}}}
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
Copyright (C) 2012-2013 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::BasicTypes
|
9
|
+
class M17n
|
10
|
+
|
11
|
+
# from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/zh-CN.yml
|
12
|
+
|
13
|
+
Locale_zh_CN =
|
14
|
+
{"date"=>
|
15
|
+
{"abbr_day_names"=>["日", "一", "二", "三", "四", "五", "六"],
|
16
|
+
"abbr_month_names"=>
|
17
|
+
[nil,
|
18
|
+
"1月",
|
19
|
+
"2月",
|
20
|
+
"3月",
|
21
|
+
"4月",
|
22
|
+
"5月",
|
23
|
+
"6月",
|
24
|
+
"7月",
|
25
|
+
"8月",
|
26
|
+
"9月",
|
27
|
+
"10月",
|
28
|
+
"11月",
|
29
|
+
"12月"],
|
30
|
+
"day_names"=>["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
31
|
+
"formats"=>{"default"=>"%Y-%m-%d", "long"=>"%Y年%b%d日", "short"=>"%b%d日"},
|
32
|
+
"month_names"=>
|
33
|
+
[nil,
|
34
|
+
"一月",
|
35
|
+
"二月",
|
36
|
+
"三月",
|
37
|
+
"四月",
|
38
|
+
"五月",
|
39
|
+
"六月",
|
40
|
+
"七月",
|
41
|
+
"八月",
|
42
|
+
"九月",
|
43
|
+
"十月",
|
44
|
+
"十一月",
|
45
|
+
"十二月"],
|
46
|
+
"order"=>[:year, :month, :day]},
|
47
|
+
"time"=>
|
48
|
+
{"am"=>"上午",
|
49
|
+
"formats"=>
|
50
|
+
{"default"=>"%Y年%b%d日 %A %H:%M:%S %Z",
|
51
|
+
"long"=>"%Y年%b%d日 %H:%M",
|
52
|
+
"short"=>"%b%d日 %H:%M",
|
53
|
+
"time"=>"%H:%M:%S %Z"},
|
54
|
+
"pm"=>"下午"},
|
55
|
+
"datetime"=>
|
56
|
+
{"distance_in_words"=>
|
57
|
+
{"about_x_hours"=>{"one"=>"大约一小时", "other"=>"大约 %{count} 小时"},
|
58
|
+
"about_x_months"=>{"one"=>"大约一个月", "other"=>"大约 %{count} 个月"},
|
59
|
+
"about_x_years"=>{"one"=>"大约一年", "other"=>"大约 %{count} 年"},
|
60
|
+
"almost_x_years"=>{"one"=>"接近一年", "other"=>"接近 %{count} 年"},
|
61
|
+
"half_a_minute"=>"半分钟",
|
62
|
+
"less_than_x_minutes"=>{"one"=>"不到一分钟", "other"=>"不到 %{count} 分钟"},
|
63
|
+
"less_than_x_seconds"=>{"one"=>"不到一秒", "other"=>"不到 %{count} 秒"},
|
64
|
+
"over_x_years"=>{"one"=>"一年多", "other"=>"%{count} 年多"},
|
65
|
+
"x_days"=>{"one"=>"一天", "other"=>"%{count} 天"},
|
66
|
+
"x_minutes"=>{"one"=>"一分钟", "other"=>"%{count} 分钟"},
|
67
|
+
"x_months"=>{"one"=>"一个月", "other"=>"%{count} 个月"},
|
68
|
+
"x_seconds"=>{"one"=>"一秒", "other"=>"%{count} 秒"}},
|
69
|
+
"prompts"=>
|
70
|
+
{"day"=>"日",
|
71
|
+
"hour"=>"时",
|
72
|
+
"minute"=>"分",
|
73
|
+
"month"=>"月",
|
74
|
+
"second"=>"秒",
|
75
|
+
"year"=>"年"}}}
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
Copyright (C) 2012-2013 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::BasicTypes
|
9
|
+
class M17n
|
10
|
+
|
11
|
+
# from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/zh-HK.yml
|
12
|
+
|
13
|
+
Locale_zh_HK =
|
14
|
+
{"date"=>
|
15
|
+
{"abbr_day_names"=>["日", "一", "二", "三", "四", "五", "六"],
|
16
|
+
"abbr_month_names"=>
|
17
|
+
[nil,
|
18
|
+
"1月",
|
19
|
+
"2月",
|
20
|
+
"3月",
|
21
|
+
"4月",
|
22
|
+
"5月",
|
23
|
+
"6月",
|
24
|
+
"7月",
|
25
|
+
"8月",
|
26
|
+
"9月",
|
27
|
+
"10月",
|
28
|
+
"11月",
|
29
|
+
"12月"],
|
30
|
+
"day_names"=>["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
31
|
+
"formats"=>{"default"=>"%Y-%m-%d", "long"=>"%Y年%b%d日", "short"=>"%b%d日"},
|
32
|
+
"month_names"=>
|
33
|
+
[nil,
|
34
|
+
"一月",
|
35
|
+
"二月",
|
36
|
+
"三月",
|
37
|
+
"四月",
|
38
|
+
"五月",
|
39
|
+
"六月",
|
40
|
+
"七月",
|
41
|
+
"八月",
|
42
|
+
"九月",
|
43
|
+
"十月",
|
44
|
+
"十一月",
|
45
|
+
"十二月"],
|
46
|
+
"order"=>[:year, :month, :day]},
|
47
|
+
"time"=>
|
48
|
+
{"am"=>"上晝",
|
49
|
+
"formats"=>
|
50
|
+
{"default"=>"%Y年%b%d號 %A %H:%M:%S %Z",
|
51
|
+
"long"=>"%Y年%b%d號 %H:%M",
|
52
|
+
"short"=>"%b%d號 %H:%M",
|
53
|
+
"time"=>"%H:%M:%S %Z"},
|
54
|
+
"pm"=>"下晝"},
|
55
|
+
"datetime"=>
|
56
|
+
{"distance_in_words"=>
|
57
|
+
{"about_x_hours"=>{"one"=>"大概一個鐘", "other"=>"大概%{count}個鐘"},
|
58
|
+
"about_x_months"=>{"one"=>"大概一個月", "other"=>"大概%{count}個月"},
|
59
|
+
"about_x_years"=>{"one"=>"大概一年", "other"=>"大概%{count}年"},
|
60
|
+
"almost_x_years"=>{"one"=>"差唔多一年", "other"=>"差唔多%{count}年"},
|
61
|
+
"half_a_minute"=>"半分鐘",
|
62
|
+
"less_than_x_minutes"=>{"one"=>"唔夠一分鐘", "other"=>"唔夠%{count}分鐘"},
|
63
|
+
"less_than_x_seconds"=>{"one"=>"唔夠一秒", "other"=>"唔夠%{count}秒"},
|
64
|
+
"over_x_years"=>{"one"=>"超過一年", "other"=>"超過%{count}年"},
|
65
|
+
"x_days"=>{"one"=>"一日", "other"=>"%{count}日"},
|
66
|
+
"x_minutes"=>{"one"=>"一分鐘", "other"=>"%{count}分鐘"},
|
67
|
+
"x_months"=>{"one"=>"一個月", "other"=>"%{count}個月"},
|
68
|
+
"x_seconds"=>{"one"=>"一秒", "other"=>"%{count}秒"}},
|
69
|
+
"prompts"=>
|
70
|
+
{"day"=>"日",
|
71
|
+
"hour"=>"點",
|
72
|
+
"minute"=>"分",
|
73
|
+
"month"=>"月",
|
74
|
+
"second"=>"秒",
|
75
|
+
"year"=>"年"}}}
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
Copyright (C) 2012-2013 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::BasicTypes
|
9
|
+
class M17n
|
10
|
+
|
11
|
+
# from https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/zh-TW.yml
|
12
|
+
|
13
|
+
Locale_zh_TW =
|
14
|
+
{"date"=>
|
15
|
+
{"abbr_day_names"=>["日", "一", "二", "三", "四", "五", "六"],
|
16
|
+
"abbr_month_names"=>
|
17
|
+
[nil,
|
18
|
+
"1月",
|
19
|
+
"2月",
|
20
|
+
"3月",
|
21
|
+
"4月",
|
22
|
+
"5月",
|
23
|
+
"6月",
|
24
|
+
"7月",
|
25
|
+
"8月",
|
26
|
+
"9月",
|
27
|
+
"10月",
|
28
|
+
"11月",
|
29
|
+
"12月"],
|
30
|
+
"day_names"=>["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
31
|
+
"formats"=>{"default"=>"%Y-%m-%d", "long"=>"%Y年%b%d日", "short"=>"%b%d日"},
|
32
|
+
"month_names"=>
|
33
|
+
[nil,
|
34
|
+
"一月",
|
35
|
+
"二月",
|
36
|
+
"三月",
|
37
|
+
"四月",
|
38
|
+
"五月",
|
39
|
+
"六月",
|
40
|
+
"七月",
|
41
|
+
"八月",
|
42
|
+
"九月",
|
43
|
+
"十月",
|
44
|
+
"十一月",
|
45
|
+
"十二月"],
|
46
|
+
"order"=>[:year, :month, :day]},
|
47
|
+
"time"=>
|
48
|
+
{"am"=>"上午",
|
49
|
+
"formats"=>
|
50
|
+
{"default"=>"%Y年%b%d日 %A %H:%M:%S %Z",
|
51
|
+
"long"=>"%Y年%b%d日 %H:%M",
|
52
|
+
"short"=>"%b%d日 %H:%M",
|
53
|
+
"time"=>"%H:%M:%S %Z"},
|
54
|
+
"pm"=>"下午"},
|
55
|
+
"datetime"=>
|
56
|
+
{"distance_in_words"=>
|
57
|
+
{"about_x_hours"=>{"one"=>"大約一小時", "other"=>"大約 %{count} 小時"},
|
58
|
+
"about_x_months"=>{"one"=>"大約一個月", "other"=>"大約 %{count} 個月"},
|
59
|
+
"about_x_years"=>{"one"=>"大約一年", "other"=>"大約 %{count} 年"},
|
60
|
+
"almost_x_years"=>{"one"=>"接近一年", "other"=>"接近 %{count} 年"},
|
61
|
+
"half_a_minute"=>"半分鐘",
|
62
|
+
"less_than_x_minutes"=>{"one"=>"不到一分鐘", "other"=>"不到 %{count} 分鐘"},
|
63
|
+
"less_than_x_seconds"=>{"one"=>"不到一秒", "other"=>"不到 %{count} 秒"},
|
64
|
+
"over_x_years"=>{"one"=>"一年多", "other"=>"%{count} 年多"},
|
65
|
+
"x_days"=>{"one"=>"一天", "other"=>"%{count} 天"},
|
66
|
+
"x_minutes"=>{"one"=>"一分鐘", "other"=>"%{count} 分鐘"},
|
67
|
+
"x_months"=>{"one"=>"一個月", "other"=>"%{count} 個月"},
|
68
|
+
"x_seconds"=>{"one"=>"一秒", "other"=>"%{count} 秒"}},
|
69
|
+
"prompts"=>
|
70
|
+
{"day"=>"日",
|
71
|
+
"hour"=>"時",
|
72
|
+
"minute"=>"分",
|
73
|
+
"month"=>"月",
|
74
|
+
"second"=>"秒",
|
75
|
+
"year"=>"年"}}}
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
Copyright (C) 2013 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
|
+
require 'socket'
|
9
|
+
|
10
|
+
#
|
11
|
+
# Time for v1.8.x compatibility
|
12
|
+
#
|
13
|
+
class Time
|
14
|
+
if Time.now.respond_to?(:strftime) && Time.now.strftime('%FT%X.%L').length > 0
|
15
|
+
alias :_log_ :strftime
|
16
|
+
else
|
17
|
+
def _log_(format)
|
18
|
+
"%04d-%02d-%02dT%02d:%02d:%02d.%03d" % [year, month, day, hour, min, sec, usec / 1000]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# Micro Client / Server
|
25
|
+
#
|
26
|
+
module When
|
27
|
+
class << self
|
28
|
+
|
29
|
+
#
|
30
|
+
# 設定ファイルを読み込む
|
31
|
+
# @private
|
32
|
+
def config(path=File.expand_path($0) + '.config')
|
33
|
+
config = {}
|
34
|
+
open(path, 'r') do |file|
|
35
|
+
while (line=file.gets)
|
36
|
+
next if line =~ /^\s*#/
|
37
|
+
key, *value = line.chomp.split(':')
|
38
|
+
value = value[0] if value.size <= 1
|
39
|
+
config[key] = value
|
40
|
+
end
|
41
|
+
end
|
42
|
+
config
|
43
|
+
rescue
|
44
|
+
{}
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# マイクロ・サーバーを起動する
|
49
|
+
#
|
50
|
+
# @param [#to_i] port 待ち受けるポート番号
|
51
|
+
#
|
52
|
+
# @return [void]
|
53
|
+
#
|
54
|
+
# @note mini_application
|
55
|
+
#
|
56
|
+
def server(port)
|
57
|
+
config = When.config
|
58
|
+
TCPServer.open(port.to_i) do |socket|
|
59
|
+
puts Time.now._log_('%FT%X.%L') + ': Start'
|
60
|
+
loop do
|
61
|
+
Thread.start(socket.accept) do |client|
|
62
|
+
query = client.gets.chomp.force_encoding("UTF-8")
|
63
|
+
start = Time.now
|
64
|
+
puts start._log_('%FT%X.%L') + ': Query - ' + When::Parts::Locale.translate(query, config['!'])
|
65
|
+
begin
|
66
|
+
client.puts JSON.generate(Array(free_conv(*query.split(/\s+/)))).to_s
|
67
|
+
stop = Time.now
|
68
|
+
puts stop._log_('%FT%X.%L') + ": Respond (%7.0f ms)" % (1000 * (stop.to_f - start.to_f))
|
69
|
+
rescue => err
|
70
|
+
puts Time.now._log_('%FT%X.%L') + ': error - ' + err.to_s
|
71
|
+
client.puts JSON.generate({:error=>query}).to_s
|
72
|
+
end
|
73
|
+
client.close
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
rescue Exception => e
|
78
|
+
puts Time.now._log_('%FT%X.%L') + ': Exception - ' + e.to_s
|
79
|
+
ensure
|
80
|
+
puts Time.now._log_('%FT%X.%L') + ': Done.'
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# マイクロ・クライアントを実行する
|
85
|
+
#
|
86
|
+
# @param [String] server マイクロ・サーバのアドレス
|
87
|
+
# @param [#to_i] port つなぐポート番号
|
88
|
+
# @param [String] query 問い合わせ文字列
|
89
|
+
#
|
90
|
+
# @return [JSON] 応答
|
91
|
+
#
|
92
|
+
# @note mini_application
|
93
|
+
#
|
94
|
+
def client(server, port, query)
|
95
|
+
TCPSocket.open(server, port.to_i) do |socket|
|
96
|
+
socket.puts(query)
|
97
|
+
JSON.parse(socket.gets.force_encoding("UTF-8"))
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# 日付の自由変換
|
102
|
+
#
|
103
|
+
# @param [Array<String>] args コマンドライン入力
|
104
|
+
# @param [Block] block ブロック
|
105
|
+
#
|
106
|
+
# @return [Array<Hash>] 変換結果
|
107
|
+
# @return [Array<Array<Numeric>>] 最良近似分数列
|
108
|
+
#
|
109
|
+
# @note 暦法のIRI, When.exe Standard Expression, 最良近似分数列の分母分子などを文字列で指定
|
110
|
+
# @note mini_application
|
111
|
+
#
|
112
|
+
def free_conv(*args, &block)
|
113
|
+
calendars, dates, numbers, methods, output, options = _parse(args)
|
114
|
+
|
115
|
+
if numbers.size >= 2 && calendars.size == 0
|
116
|
+
result = []
|
117
|
+
When::Coordinates::Residue.new(numbers[0], numbers[1]).each { |v| result << v }
|
118
|
+
return result
|
119
|
+
end
|
120
|
+
|
121
|
+
block ||=
|
122
|
+
if methods.size == 0
|
123
|
+
lambda {|date| date.send(*output)}
|
124
|
+
else
|
125
|
+
lambda {|date, type|
|
126
|
+
case type
|
127
|
+
when When::YEAR ; date.strftime("%Y")
|
128
|
+
when When::MONTH ; date.strftime("%B %Y")
|
129
|
+
when When::WEEK ; nil
|
130
|
+
when When::DAY ; date[0]
|
131
|
+
else ; '-'
|
132
|
+
end
|
133
|
+
}
|
134
|
+
end
|
135
|
+
_free_conv(calendars, dates, methods, output, options, &block)
|
136
|
+
end
|
137
|
+
|
138
|
+
# 引数読み込み
|
139
|
+
#
|
140
|
+
# args [String] コマンドライン入力
|
141
|
+
#
|
142
|
+
# @return [Array] ( calendars, dates, numbers, methods )
|
143
|
+
# [ calendars [Array<When::TM::Calendar or When::TM::CalendarEra>]]
|
144
|
+
# [ dates [Array<When::TM::CalData or When::TM::DateAndTime>] ]
|
145
|
+
# [ numbers [Array<Numeric>]]
|
146
|
+
# [ methods [Array<String>] メソッド名('week', 'month', 'year') ]
|
147
|
+
# [ output [Array<Symbol, String>] 出力処理に使うメソッドのシンボルと引数 ]
|
148
|
+
# [ options [Hash{ :extent=>Boolean, :go_back=><:All || :Before(nil) || :After> }]
|
149
|
+
#
|
150
|
+
# @private
|
151
|
+
def _parse(args)
|
152
|
+
calendars = []
|
153
|
+
dates = []
|
154
|
+
numbers = []
|
155
|
+
methods = []
|
156
|
+
options = {}
|
157
|
+
output = [:to_s]
|
158
|
+
|
159
|
+
config = When.config
|
160
|
+
args.flatten.each do |arg|
|
161
|
+
case arg
|
162
|
+
when Numeric ; dates << arg ; numbers << arg
|
163
|
+
when Hash ; options.update(arg)
|
164
|
+
when Range ; arg.each {|d| dates << d}
|
165
|
+
when Symbol ; output = arg
|
166
|
+
when String
|
167
|
+
case arg
|
168
|
+
when /^:(.+?)(?:\[(..)\])?$/ ; output = [$1.to_sym, $2].compact
|
169
|
+
when /^(year|month|week)(?:\[(..)\])?$/i ; methods << [$1.downcase + '_included', $2||'SU']
|
170
|
+
when /^[-+\d]\d*$/ ; dates << arg.to_i ; numbers << arg.to_i
|
171
|
+
when /^[-+.\d][.\d]*$/ ; dates << arg.to_f ; numbers << arg.to_f
|
172
|
+
when /^now$/i ; dates << When.now
|
173
|
+
when /^today$/i ; dates << When.today
|
174
|
+
when /(^[-+\d])|\^/ ; dates << arg
|
175
|
+
when /^\//
|
176
|
+
arg[1..-1].scan(/./) do |c|
|
177
|
+
c = c.upcase
|
178
|
+
if config.key?(c)
|
179
|
+
calendar = config[c]
|
180
|
+
calendar = calendar.join(':') if calendar.kind_of?(Array)
|
181
|
+
calendars << When.Calendar(calendar)
|
182
|
+
elsif c == 'D'
|
183
|
+
calendars << When::TM::JulianDate
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else
|
187
|
+
begin
|
188
|
+
calendars << ((arg == 'JulianDate') ? When::TM::JulianDate : When.Calendar(arg))
|
189
|
+
rescue NameError, OpenURI::HTTPError
|
190
|
+
dates << arg
|
191
|
+
end
|
192
|
+
end
|
193
|
+
else
|
194
|
+
dates << arg
|
195
|
+
end
|
196
|
+
end
|
197
|
+
[calendars, dates, numbers, methods, output, options]
|
198
|
+
end
|
199
|
+
|
200
|
+
# 変換処理(実行部)
|
201
|
+
#
|
202
|
+
# @param [When::TM::Calendar, When::TM::CalendarEra] calendars
|
203
|
+
# @param [When::TM::CalData, When::TM::DateAndTime] dates
|
204
|
+
# @param [String] methods メソッド名('week', 'month', 'year')
|
205
|
+
# @param [Hash] options {:extent=>Boolean, :go_back=><:All||:Before(nil)||:After>}
|
206
|
+
#
|
207
|
+
# @return [Array] 変換結果
|
208
|
+
#
|
209
|
+
# @private
|
210
|
+
def _free_conv(calendars, dates, methods, output, options, &block)
|
211
|
+
dates[0] ||= When.now
|
212
|
+
calendars[0] ||= When.Calendar('Gregorian')
|
213
|
+
result = dates.map {|date|
|
214
|
+
date = When.when?(date)
|
215
|
+
list = calendars.dup
|
216
|
+
(0...calendars.size).to_a.reverse.each do |i|
|
217
|
+
case list[i]
|
218
|
+
when When::TM::Calendar ; list.slice!(i) if options[:extent] && !list[i].domain.include?(date)
|
219
|
+
when Class ;
|
220
|
+
else
|
221
|
+
eras = (date ^ list[i]).delete_if {|e| !e.leaf?}
|
222
|
+
unless options[:go_back] == :All
|
223
|
+
if options[:go_back] == :After
|
224
|
+
eras = [eras[(eras.index {|e| e.calendar_era_name[3]}) || -1]]
|
225
|
+
else
|
226
|
+
eras.delete_if {|e| e.calendar_era_name[3]}
|
227
|
+
end
|
228
|
+
end
|
229
|
+
list[i,1] = eras.map {|e| e.calendar_era}
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
if methods.size == 0
|
234
|
+
list.map {|calendar|
|
235
|
+
calendar.kind_of?(Class) ?
|
236
|
+
yield(calendar.new(date)) :
|
237
|
+
yield(calendar ^ (calendar.rate_of_clock == date.rate_of_clock ? date.to_i : date))
|
238
|
+
}
|
239
|
+
else
|
240
|
+
list.map {|calendar|
|
241
|
+
date_for_calendar = calendar ^ (calendar.rate_of_clock == date.rate_of_clock ? date.to_i : date)
|
242
|
+
methods.map {|method|
|
243
|
+
date_for_calendar.send(method[0].to_sym, method[1], &block)
|
244
|
+
}
|
245
|
+
}
|
246
|
+
end
|
247
|
+
}
|
248
|
+
result = result[0] while result.kind_of?(Array) && result.size == 1
|
249
|
+
return result
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|