el_generators 0.0.2 → 0.0.3
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.
- data/lib/el_generators/version.rb +1 -1
- data/lib/generators/i18n_ja/USAGE +8 -0
- data/lib/generators/i18n_ja/i18n_ja_generator.rb +9 -0
- data/lib/generators/i18n_ja/templates/ja.yml +233 -0
- data/lib/generators/messages/messages_generator.rb +9 -2
- data/lib/generators/messages/templates/add_human_to_active_record.rb +9 -0
- data/lib/generators/messages/templates/messages.rb +29 -0
- metadata +7 -2
@@ -0,0 +1,9 @@
|
|
1
|
+
class I18nJaGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
|
4
|
+
def create_i18n_ja_yml
|
5
|
+
f = open("lib/generators/i18n_ja/templates/ja.yml");print v = f.read;f.close;
|
6
|
+
create_file "config/locales/ja.yml", v
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
@@ -0,0 +1,233 @@
|
|
1
|
+
# Japanese translations for Ruby on Rails
|
2
|
+
# by Akira Matsuda (ronnie@dio.jp)
|
3
|
+
# AR error messages are basically taken from Ruby-GetText-Package. Thanks to Masao Mutoh.
|
4
|
+
# contributors:
|
5
|
+
# - Tsutomu Kuroda (t-kuroda@oiax.jp)
|
6
|
+
|
7
|
+
ja:
|
8
|
+
terms:
|
9
|
+
target_create: "%{target}登録"
|
10
|
+
target_detail: "%{target}詳細"
|
11
|
+
target_edit: "%{target}編集"
|
12
|
+
target_list: "%{target}一覧"
|
13
|
+
target_new: "%{target}新規作成"
|
14
|
+
target_newly: "%{target}新規"
|
15
|
+
target_update: "%{target}更新"
|
16
|
+
target_person: "対象者"
|
17
|
+
target_was_successfully_updated: "%{target}の更新を完了しました。"
|
18
|
+
target_was_successfully_created: "%{target}を作成しました。"
|
19
|
+
there_is_no: "%{target}が存在していません"
|
20
|
+
user_details: "ユーザー詳細"
|
21
|
+
genders:
|
22
|
+
male: "男性"
|
23
|
+
female: "女性"
|
24
|
+
|
25
|
+
messages:
|
26
|
+
confirm:
|
27
|
+
destroy: "%{target}を削除します。よろしいですか?"
|
28
|
+
destroy_project_member: "%{target}をプロジェクトから外します。よろしいですか?"
|
29
|
+
destroy_belonging: "%{target}を%{department}から外します。よろしいですか?"
|
30
|
+
destory_message: "メッセージ「%{target}」を削除します。よろしいですか?"
|
31
|
+
complete:
|
32
|
+
create: "%{target}を登録しました。"
|
33
|
+
update: "%{target}を更新しました。"
|
34
|
+
destroy: "%{target}を削除しました。"
|
35
|
+
logout: "ログアウトしました。"
|
36
|
+
empty: "%{target}はありません。"
|
37
|
+
destroy:
|
38
|
+
date:
|
39
|
+
abbr_day_names:
|
40
|
+
- 日
|
41
|
+
- 月
|
42
|
+
- 火
|
43
|
+
- 水
|
44
|
+
- 木
|
45
|
+
- 金
|
46
|
+
- 土
|
47
|
+
abbr_month_names:
|
48
|
+
-
|
49
|
+
- 1月
|
50
|
+
- 2月
|
51
|
+
- 3月
|
52
|
+
- 4月
|
53
|
+
- 5月
|
54
|
+
- 6月
|
55
|
+
- 7月
|
56
|
+
- 8月
|
57
|
+
- 9月
|
58
|
+
- 10月
|
59
|
+
- 11月
|
60
|
+
- 12月
|
61
|
+
day_names:
|
62
|
+
- 日曜日
|
63
|
+
- 月曜日
|
64
|
+
- 火曜日
|
65
|
+
- 水曜日
|
66
|
+
- 木曜日
|
67
|
+
- 金曜日
|
68
|
+
- 土曜日
|
69
|
+
formats:
|
70
|
+
default: ! '%Y/%m/%d'
|
71
|
+
long: ! '%Y年%m月%d日(%a)'
|
72
|
+
short: ! '%m/%d'
|
73
|
+
month_names:
|
74
|
+
-
|
75
|
+
- 1月
|
76
|
+
- 2月
|
77
|
+
- 3月
|
78
|
+
- 4月
|
79
|
+
- 5月
|
80
|
+
- 6月
|
81
|
+
- 7月
|
82
|
+
- 8月
|
83
|
+
- 9月
|
84
|
+
- 10月
|
85
|
+
- 11月
|
86
|
+
- 12月
|
87
|
+
order:
|
88
|
+
- :year
|
89
|
+
- :month
|
90
|
+
- :day
|
91
|
+
datetime:
|
92
|
+
distance_in_words:
|
93
|
+
about_x_hours:
|
94
|
+
one: 約1時間
|
95
|
+
other: 約%{count}時間
|
96
|
+
about_x_months:
|
97
|
+
one: 約1ヶ月
|
98
|
+
other: 約%{count}ヶ月
|
99
|
+
about_x_years:
|
100
|
+
one: 約1年
|
101
|
+
other: 約%{count}年
|
102
|
+
almost_x_years:
|
103
|
+
one: 1年弱
|
104
|
+
other: ! '%{count}年弱'
|
105
|
+
half_a_minute: 30秒前後
|
106
|
+
less_than_x_minutes:
|
107
|
+
one: 1分以内
|
108
|
+
other: ! '%{count}分以内'
|
109
|
+
less_than_x_seconds:
|
110
|
+
one: 1秒以内
|
111
|
+
other: ! '%{count}秒以内'
|
112
|
+
over_x_years:
|
113
|
+
one: 1年以上
|
114
|
+
other: ! '%{count}年以上'
|
115
|
+
x_days:
|
116
|
+
one: 1日
|
117
|
+
other: ! '%{count}日'
|
118
|
+
x_minutes:
|
119
|
+
one: 1分
|
120
|
+
other: ! '%{count}分'
|
121
|
+
x_months:
|
122
|
+
one: 1ヶ月
|
123
|
+
other: ! '%{count}ヶ月'
|
124
|
+
x_seconds:
|
125
|
+
one: 1秒
|
126
|
+
other: ! '%{count}秒'
|
127
|
+
prompts:
|
128
|
+
day: 日
|
129
|
+
hour: 時
|
130
|
+
minute: 分
|
131
|
+
month: 月
|
132
|
+
second: 秒
|
133
|
+
year: 年
|
134
|
+
errors: &errors
|
135
|
+
format: ! '%{attribute}%{message}'
|
136
|
+
messages:
|
137
|
+
accepted: を受諾してください。
|
138
|
+
blank: を入力してください。
|
139
|
+
confirmation: と確認の入力が一致しません。
|
140
|
+
empty: を入力してください。
|
141
|
+
equal_to: は%{count}にしてください。
|
142
|
+
even: は偶数にしてください。
|
143
|
+
exclusion: は予約されています。
|
144
|
+
greater_than: は%{count}より大きい値にしてください。
|
145
|
+
greater_than_or_equal_to: は%{count}以上の値にしてください。
|
146
|
+
inclusion: は一覧にありません。
|
147
|
+
invalid: は不正な値です。
|
148
|
+
less_than: は%{count}より小さい値にしてください。
|
149
|
+
less_than_or_equal_to: は%{count}以下の値にしてください。
|
150
|
+
not_a_number: は数値で入力してください。
|
151
|
+
not_an_integer: は整数で入力してください。
|
152
|
+
odd: は奇数にしてください。
|
153
|
+
record_invalid: バリデーションに失敗しました。 %{errors}
|
154
|
+
taken: はすでに存在します。
|
155
|
+
too_long: は%{count}文字以内で入力してください。
|
156
|
+
too_short: は%{count}文字以上で入力してください。
|
157
|
+
wrong_length: は%{count}文字で入力してください。
|
158
|
+
template:
|
159
|
+
body: 次の項目を確認してください。
|
160
|
+
header:
|
161
|
+
one: ! '%{model}にエラーが発生しました。'
|
162
|
+
other: ! '%{model}に%{count}つのエラーが発生しました。'
|
163
|
+
helpers:
|
164
|
+
select:
|
165
|
+
prompt: 選択してください。
|
166
|
+
submit:
|
167
|
+
create: 登録する
|
168
|
+
submit: 保存する
|
169
|
+
update: 更新する
|
170
|
+
number:
|
171
|
+
currency:
|
172
|
+
format:
|
173
|
+
delimiter: ! ','
|
174
|
+
format: ! '%n%u'
|
175
|
+
precision: 0
|
176
|
+
separator: .
|
177
|
+
significant: false
|
178
|
+
strip_insignificant_zeros: false
|
179
|
+
unit: 円
|
180
|
+
format:
|
181
|
+
delimiter: ! ','
|
182
|
+
precision: 3
|
183
|
+
separator: .
|
184
|
+
significant: false
|
185
|
+
strip_insignificant_zeros: false
|
186
|
+
human:
|
187
|
+
decimal_units:
|
188
|
+
format: ! '%n %u'
|
189
|
+
units:
|
190
|
+
billion: 十億
|
191
|
+
million: 百万
|
192
|
+
quadrillion: 千兆
|
193
|
+
thousand: 千
|
194
|
+
trillion: 兆
|
195
|
+
unit: ''
|
196
|
+
format:
|
197
|
+
delimiter: ''
|
198
|
+
precision: 3
|
199
|
+
significant: true
|
200
|
+
strip_insignificant_zeros: true
|
201
|
+
storage_units:
|
202
|
+
format: ! '%n%u'
|
203
|
+
units:
|
204
|
+
byte: バイト
|
205
|
+
gb: ギガバイト
|
206
|
+
kb: キロバイト
|
207
|
+
mb: メガバイト
|
208
|
+
tb: テラバイト
|
209
|
+
percentage:
|
210
|
+
format:
|
211
|
+
delimiter: ''
|
212
|
+
precision:
|
213
|
+
format:
|
214
|
+
delimiter: ''
|
215
|
+
support:
|
216
|
+
array:
|
217
|
+
last_word_connector: と
|
218
|
+
two_words_connector: と
|
219
|
+
words_connector: と
|
220
|
+
time:
|
221
|
+
am: 午前
|
222
|
+
formats:
|
223
|
+
default: ! '%Y/%m/%d %H:%M:%S'
|
224
|
+
long: ! '%Y年%m月%d日(%a) %H時%M分%S秒 %z'
|
225
|
+
short: ! '%y/%m/%d %H:%M'
|
226
|
+
pm: 午後
|
227
|
+
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
|
228
|
+
activemodel:
|
229
|
+
errors:
|
230
|
+
<<: *errors
|
231
|
+
activerecord:
|
232
|
+
errors:
|
233
|
+
<<: *errors
|
@@ -2,10 +2,9 @@
|
|
2
2
|
class MessagesGenerator < Rails::Generators::Base
|
3
3
|
source_root File.expand_path('../templates', __FILE__)
|
4
4
|
|
5
|
-
def
|
5
|
+
def create_messages
|
6
6
|
create_file "config/locales/messages_ja.yml", <<EOS
|
7
7
|
ja:
|
8
|
-
terms:
|
9
8
|
messages:
|
10
9
|
confirm:
|
11
10
|
destroy: "%{target}を削除します。よろしいですか?"
|
@@ -15,5 +14,13 @@ ja:
|
|
15
14
|
destroy: "%{target}を削除しました。"
|
16
15
|
empty: "%{target}はありません。"
|
17
16
|
EOS
|
17
|
+
create_file "config/locales/terms_ja.yml", <<EOS
|
18
|
+
ja:
|
19
|
+
terms:
|
20
|
+
EOS
|
21
|
+
copy_file "messages.rb", "app/controllers/messages.rb"
|
22
|
+
insert_into_file "app/controllers/application_controller.rb", " include Messages\n\n", :after => "class ApplicationController < ActionController::Base\n"
|
23
|
+
|
24
|
+
copy_file "add_human_to_active_record.rb", "config/initializers/add_human_to_active_record.rb"
|
18
25
|
end
|
19
26
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module InstanceHuman
|
3
|
+
def human
|
4
|
+
"#{self.class.model_name.human}「#{truncate(name, :length => 20)}」"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
ActiveRecord::Base.send(:include, ActionView::Helpers::TextHelper) # to use truncate
|
8
|
+
|
9
|
+
ActiveRecord::Base.send(:include, InstanceHuman)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Messages
|
2
|
+
def self.included(base)
|
3
|
+
base.helper_method :term, :message_on_create, :message_on_update, :message_on_destroy, :confirm_message_on_destroy
|
4
|
+
end
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def term(key, *args)
|
9
|
+
I18n.t("terms.#{key}", *args)
|
10
|
+
end
|
11
|
+
|
12
|
+
def message_on_create(obj)
|
13
|
+
I18n.t("messages.complete.create", :target => obj.human)
|
14
|
+
end
|
15
|
+
|
16
|
+
def message_on_update(obj)
|
17
|
+
I18n.t("messages.complete.update", :target => obj.human)
|
18
|
+
end
|
19
|
+
|
20
|
+
def message_on_destroy(obj)
|
21
|
+
I18n.t("messages.complete.destroy", :target => obj.human)
|
22
|
+
end
|
23
|
+
|
24
|
+
def confirm_message_on_destroy(obj)
|
25
|
+
I18n.t("messages.confirm.destroy", :target => obj.human)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: el_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Basic generators for standard Rails applications
|
15
15
|
email:
|
@@ -24,8 +24,13 @@ files:
|
|
24
24
|
- el_generators.gemspec
|
25
25
|
- lib/el_generators.rb
|
26
26
|
- lib/el_generators/version.rb
|
27
|
+
- lib/generators/i18n_ja/USAGE
|
28
|
+
- lib/generators/i18n_ja/i18n_ja_generator.rb
|
29
|
+
- lib/generators/i18n_ja/templates/ja.yml
|
27
30
|
- lib/generators/messages/USAGE
|
28
31
|
- lib/generators/messages/messages_generator.rb
|
32
|
+
- lib/generators/messages/templates/add_human_to_active_record.rb
|
33
|
+
- lib/generators/messages/templates/messages.rb
|
29
34
|
homepage: ''
|
30
35
|
licenses: []
|
31
36
|
post_install_message:
|