amatsuda-i18n_generators 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README +56 -0
- data/Rakefile +22 -0
- data/generators/i18n/USAGE +13 -0
- data/generators/i18n/i18n_generator.rb +41 -0
- data/generators/i18n/templates/base.yml +0 -0
- data/generators/i18n/templates/i18n_config.rb +5 -0
- data/generators/i18n/templates/models.yml +16 -0
- data/generators/i18n_locales/USAGE +12 -0
- data/generators/i18n_locales/i18n_locales_command.rb +91 -0
- data/generators/i18n_locales/i18n_locales_generator.rb +9 -0
- data/generators/i18n_locales/lib/cldr.rb +125 -0
- data/generators/i18n_locales/lib/yaml.rb +141 -0
- data/generators/i18n_models/USAGE +9 -0
- data/generators/i18n_models/i18n_models_command.rb +48 -0
- data/generators/i18n_models/i18n_models_generator.rb +9 -0
- data/generators/i18n_models/lib/translator.rb +21 -0
- data/spec/cldr_spec.rb +52 -0
- data/spec/data/cldr/ja.html +3112 -0
- data/spec/data/yml/active_record/en-US.yml +54 -0
- data/spec/yaml_spec.rb +39 -0
- metadata +81 -0
data/spec/cldr_spec.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
$KCODE = 'U'
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), '../generators/i18n_locales/lib/cldr')
|
4
|
+
include I18nLocalesGeneratorModule
|
5
|
+
|
6
|
+
describe CldrDocument do
|
7
|
+
before do
|
8
|
+
OpenURI.stub!(:open_uri).and_return(File.open(File.join(File.dirname(__FILE__), 'data/cldr/ja.html')))
|
9
|
+
@cldr = CldrDocument.new 'ja-JP'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'fetches date/formats/default value' do
|
13
|
+
@cldr.lookup('date/formats/default').should == '%Y/%m/%d'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'fetches date/formats/short value' do
|
17
|
+
@cldr.lookup('date/formats/short').should == '%y/%m/%d'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'fetches date/formats/long value' do
|
21
|
+
@cldr.lookup('date/formats/long').should == '%Y年%m月%d日%A'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'fetches date/day_names value' do
|
25
|
+
@cldr.lookup('date/day_names').should == ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日']
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'fetches date/abbr_day_names value' do
|
29
|
+
@cldr.lookup('date/abbr_day_names').should == ['日', '月', '火', '水', '木', '金', '土']
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'fetches time/formats/default value' do
|
33
|
+
@cldr.lookup('time/formats/default').should == '%Y/%m/%d %H:%M:%S'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'fetches time/formats/short value' do
|
37
|
+
@cldr.lookup('time/formats/short').should == '%y/%m/%d %H:%M'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'fetches time/formats/long value' do
|
41
|
+
@cldr.lookup('time/formats/long').should == '%Y年%m月%d日%A %H時%M分%S秒%Z'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'fetches time/am value' do
|
45
|
+
@cldr.lookup('time/am').should == '午前'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'fetches time/pm value' do
|
49
|
+
@cldr.lookup('time/pm').should == '午後'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|