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
@@ -0,0 +1,54 @@
|
|
1
|
+
en-US:
|
2
|
+
activerecord:
|
3
|
+
errors:
|
4
|
+
# The values :model, :attribute and :value are always available for interpolation
|
5
|
+
# The value :count is available when applicable. Can be used for pluralization.
|
6
|
+
messages:
|
7
|
+
inclusion: "is not included in the list"
|
8
|
+
exclusion: "is reserved"
|
9
|
+
invalid: "is invalid"
|
10
|
+
confirmation: "doesn't match confirmation"
|
11
|
+
accepted: "must be accepted"
|
12
|
+
empty: "can't be empty"
|
13
|
+
blank: "can't be blank"
|
14
|
+
too_long: "is too long (maximum is {{count}} characters)"
|
15
|
+
too_short: "is too short (minimum is {{count}} characters)"
|
16
|
+
wrong_length: "is the wrong length (should be {{count}} characters)"
|
17
|
+
taken: "has already been taken"
|
18
|
+
not_a_number: "is not a number"
|
19
|
+
greater_than: "must be greater than {{count}}"
|
20
|
+
greater_than_or_equal_to: "must be greater than or equal to {{count}}"
|
21
|
+
equal_to: "must be equal to {{count}}"
|
22
|
+
less_than: "must be less than {{count}}"
|
23
|
+
less_than_or_equal_to: "must be less than or equal to {{count}}"
|
24
|
+
odd: "must be odd"
|
25
|
+
even: "must be even"
|
26
|
+
# Append your own errors here or at the model/attributes scope.
|
27
|
+
|
28
|
+
# You can define own errors for models or model attributes.
|
29
|
+
# The values :model, :attribute and :value are always available for interpolation.
|
30
|
+
#
|
31
|
+
# For example,
|
32
|
+
# models:
|
33
|
+
# user:
|
34
|
+
# blank: "This is a custom blank message for {{model}}: {{attribute}}"
|
35
|
+
# attributes:
|
36
|
+
# login:
|
37
|
+
# blank: "This is a custom blank message for User login"
|
38
|
+
# Will define custom blank validation message for User model and
|
39
|
+
# custom blank validation message for login attribute of User model.
|
40
|
+
models:
|
41
|
+
|
42
|
+
# Translate model names. Used in Model.human_name().
|
43
|
+
#models:
|
44
|
+
# For example,
|
45
|
+
# user: "Dude"
|
46
|
+
# will translate User model name to "Dude"
|
47
|
+
|
48
|
+
# Translate model attribute names. Used in Model.human_attribute_name(attribute).
|
49
|
+
#attributes:
|
50
|
+
# For example,
|
51
|
+
# user:
|
52
|
+
# login: "Handle"
|
53
|
+
# will translate User attribute "login" as "Handle"
|
54
|
+
|
data/spec/yaml_spec.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '/../generators/i18n_locales/lib/yaml')
|
2
|
+
include I18nLocalesGeneratorModule
|
3
|
+
|
4
|
+
describe 'Yaml' do
|
5
|
+
before do
|
6
|
+
@yaml = YamlDocument.new File.join(File.dirname(__FILE__), 'data/yml/active_record/en-US.yml'), 'ja-JP'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe YamlDocument do
|
10
|
+
it 'should return the top level node with the square bracket method' do
|
11
|
+
node = @yaml['ja-JP']
|
12
|
+
node.should be_an_instance_of(Node)
|
13
|
+
node.key.should == 'ja-JP'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should generate a path string on the top node' do
|
17
|
+
@yaml['ja-JP'].path.should == '/ja-JP'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Node do
|
22
|
+
before do
|
23
|
+
@node = Node.new @yaml, 100, 'foo: bar'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should return a key string from input text' do
|
27
|
+
@node.key.should == 'foo'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should return a value string from input text' do
|
31
|
+
@node.value.should == 'bar'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should generate a path string on any node' do
|
35
|
+
@yaml['ja-JP']['activerecord']['errors']['messages'].path.should == '/ja-JP/activerecord/errors/messages'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: amatsuda-i18n_generators
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Akira Matsuda
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-15 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: gettext
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
24
|
+
description: A Rails generator plugin & gem that generates Rails 2.2 I18n locale files for almost every known locale.
|
25
|
+
email: ronnie@dio.jp
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- MIT-LICENSE
|
34
|
+
- README
|
35
|
+
- Rakefile
|
36
|
+
- generators/i18n/USAGE
|
37
|
+
- generators/i18n/i18n_generator.rb
|
38
|
+
- generators/i18n_locales/USAGE
|
39
|
+
- generators/i18n_locales/i18n_locales_command.rb
|
40
|
+
- generators/i18n_locales/i18n_locales_generator.rb
|
41
|
+
- generators/i18n_locales/lib/cldr.rb
|
42
|
+
- generators/i18n_locales/lib/yaml.rb
|
43
|
+
- generators/i18n_models/USAGE
|
44
|
+
- generators/i18n_models/i18n_models_command.rb
|
45
|
+
- generators/i18n_models/i18n_models_generator.rb
|
46
|
+
- generators/i18n_models/lib/translator.rb
|
47
|
+
- generators/i18n/templates/base.yml
|
48
|
+
- generators/i18n/templates/i18n_config.rb
|
49
|
+
- generators/i18n/templates/models.yml
|
50
|
+
- spec/cldr_spec.rb
|
51
|
+
- spec/data/cldr/ja.html
|
52
|
+
- spec/data/yml/active_record/en-US.yml
|
53
|
+
- spec/yaml_spec.rb
|
54
|
+
has_rdoc: false
|
55
|
+
homepage: http://github.com/amatsuda/i18n_generators/
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.2.0
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: Generates I18n locale files for Rails 2.2
|
80
|
+
test_files: []
|
81
|
+
|