localized_model_generator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +11 -6
- data/lib/generators/templates/rails/localized_active_record/localize.yml.erb +3 -3
- data/lib/localized_model_generator/version.rb +1 -1
- metadata +13 -19
- data/LICENSE.txt +0 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb2922b133c749ba688fa83cc767e9cb5807b6dd
|
4
|
+
data.tar.gz: 41aafa910725fe98c2bfa7d2ba168def3a58f07d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5766570f74f2f5b536826e688562395ef36fbae30d228f9d968bcbc69014c4dd5a415bf4998dd51c45bbd5d2a565ce9920f4a8526496055b09f281e561386023
|
7
|
+
data.tar.gz: 8f79a96e535e6f20ca75875ac7f68a0166f5d28fc9c25f00b813f65f9bc2016199d6cdaab46fa21b62229cdc5dbac149ba288544ea517f5482b26612a4362f5c
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Bernd M. Walter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -20,20 +20,25 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
After installation you can create a new model with
|
22
22
|
|
23
|
-
$ rails g localized_active_record user
|
24
|
-
|
25
|
-
|
23
|
+
$ rails g localized_active_record user first_name:string last_name:string email:string blah:reference --locale=de
|
24
|
+
create db/migrate/20131207124707_create_users.rb
|
25
|
+
create app/models/user.rb
|
26
|
+
invoke test_unit
|
27
|
+
create test/unit/user_test.rb
|
28
|
+
create test/fixtures/users.yml
|
29
|
+
create config/locales/user.en.yml
|
30
|
+
create config/locales/user.de.yml
|
31
|
+
|
32
|
+
As you can see, all files where generated as if you would use the model generator except the two YML files in /config/locale. (The english version ist created automatically.)
|
26
33
|
These files contain the Active Record translations, which can be used immediatelly in your views.
|
27
34
|
|
28
35
|
If you always have the same languages, you need to translate, you can preset those in your application configuration (/config/application.rb):
|
29
36
|
|
30
37
|
config.generators.locale = %w(de,es)
|
31
38
|
|
32
|
-
Btw: the english localization file is always included!
|
33
|
-
|
34
39
|
Finally, if you want to use this model generator also in your scaffold generator, you have to add the following in your application configuration (/config/application.rb):
|
35
40
|
|
36
|
-
config,
|
41
|
+
config,generators.orm = localized_active_record
|
37
42
|
|
38
43
|
## Contributing
|
39
44
|
|
@@ -4,8 +4,8 @@
|
|
4
4
|
<%= singular_table_name %>:
|
5
5
|
one: <%= human_name %>
|
6
6
|
other: <%= human_name.pluralize %>
|
7
|
-
|
8
|
-
|
7
|
+
attributes:
|
8
|
+
<%= singular_table_name %>:
|
9
9
|
<% for attribute in attributes -%>
|
10
|
-
|
10
|
+
<%= attribute.name %>: <%= attribute.human_name %>
|
11
11
|
<% end -%>
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localized_model_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Bernd M. Walter
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: extends the active_record:model generator with locale files in /config/locales.
|
@@ -52,9 +47,9 @@ executables: []
|
|
52
47
|
extensions: []
|
53
48
|
extra_rdoc_files: []
|
54
49
|
files:
|
55
|
-
- .gitignore
|
50
|
+
- ".gitignore"
|
56
51
|
- Gemfile
|
57
|
-
- LICENSE
|
52
|
+
- LICENSE
|
58
53
|
- README.md
|
59
54
|
- Rakefile
|
60
55
|
- lib/generators/rails/localized_active_record/localized_active_record_generator.rb
|
@@ -65,26 +60,25 @@ files:
|
|
65
60
|
homepage: ''
|
66
61
|
licenses:
|
67
62
|
- MIT
|
63
|
+
metadata: {}
|
68
64
|
post_install_message:
|
69
65
|
rdoc_options: []
|
70
66
|
require_paths:
|
71
67
|
- lib
|
72
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
69
|
requirements:
|
75
|
-
- -
|
70
|
+
- - ">="
|
76
71
|
- !ruby/object:Gem::Version
|
77
72
|
version: '0'
|
78
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
74
|
requirements:
|
81
|
-
- -
|
75
|
+
- - ">="
|
82
76
|
- !ruby/object:Gem::Version
|
83
77
|
version: '0'
|
84
78
|
requirements: []
|
85
79
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.
|
80
|
+
rubygems_version: 2.1.11
|
87
81
|
signing_key:
|
88
|
-
specification_version:
|
82
|
+
specification_version: 4
|
89
83
|
summary: extends the active_record:model generator with locale files
|
90
84
|
test_files: []
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Bernd M. Walter
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|