pickle_i18n 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/pickle_i18n.rb +13 -5
  3. data/pickle_i18n.gemspec +3 -4
  4. metadata +5 -29
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/pickle_i18n.rb CHANGED
@@ -16,17 +16,25 @@ module PickleI18n
16
16
  Pickle::Parser.send(:include, PickleI18n::Parser)
17
17
  Pickle::Session.send(:include, PickleI18n::Session)
18
18
 
19
-
20
19
  # pickle_config.factories の中身はこんな感じ
21
20
  # {"product"=>#<Pickle::Adapter::FactoryGirl:0x00000102b0b618 @klass=Product(id: integer, name: string, price: decimal, created_at: datetime, updated_at: datetime), @name="product">}
22
21
  # モデルの日本語名についてもfactoryを設定します
23
22
  # pickle_config.factories['商品'] = pickle_config.factories['product']
24
- I18n.t(:activemodel, :locale => locale).tap do |translations|
25
- model_translations.update(translations[:models].stringify_keys.invert)
26
- translations[:attributes].each do |model_name, attrs|
27
- model_attribute_translations[model_name.to_s] = attrs.stringify_keys.invert
23
+
24
+ [:activemodel, :activerecord].each do |scope|
25
+ begin
26
+ models_hash = I18n.config.backend.translate(locale, :models, :scope => scope)
27
+ model_translations.update(models_hash.stringify_keys.invert)
28
+
29
+ model_to_attr_hash = I18n.config.backend.translate(locale, :attributes, :scope => scope)
30
+ model_to_attr_hash.each do |model_name, attr_hash|
31
+ model_attribute_translations[model_name.to_s] = attr_hash.stringify_keys.invert
32
+ end
33
+ rescue I18n::MissingTranslationData
34
+ # 翻訳が見つからない場合はスルーします
28
35
  end
29
36
  end
37
+
30
38
  model_translations.each do |key, value|
31
39
  pickle_config.factories[key] = pickle_config.factories[value]
32
40
  end
data/pickle_i18n.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pickle_i18n}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["akimatter"]
12
- s.date = %q{2011-05-19}
12
+ s.date = %q{2011-05-20}
13
13
  s.description = %q{pickle_i18n support pickle internationalization}
14
14
  s.email = %q{akm2000@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -35,11 +35,10 @@ Gem::Specification.new do |s|
35
35
  s.homepage = %q{http://github.com/akm/pickle_i18n}
36
36
  s.licenses = ["MIT"]
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.7}
38
+ s.rubygems_version = %q{1.6.2}
39
39
  s.summary = %q{pickle_i18n support pickle internationalization}
40
40
 
41
41
  if s.respond_to? :specification_version then
42
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
42
  s.specification_version = 3
44
43
 
45
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickle_i18n
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 1
9
- version: 0.0.1
4
+ prerelease:
5
+ version: 0.0.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - akimatter
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-05-19 00:00:00 +09:00
13
+ date: 2011-05-20 00:00:00 +09:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -24,10 +20,6 @@ dependencies:
24
20
  requirements:
25
21
  - - ~>
26
22
  - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 3
30
- - 0
31
23
  version: 2.3.0
32
24
  type: :development
33
25
  prerelease: false
@@ -39,10 +31,6 @@ dependencies:
39
31
  requirements:
40
32
  - - ~>
41
33
  - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- - 6
45
- - 0
46
34
  version: 0.6.0
47
35
  type: :development
48
36
  prerelease: false
@@ -54,10 +42,6 @@ dependencies:
54
42
  requirements:
55
43
  - - ~>
56
44
  - !ruby/object:Gem::Version
57
- segments:
58
- - 1
59
- - 0
60
- - 0
61
45
  version: 1.0.0
62
46
  type: :development
63
47
  prerelease: false
@@ -69,10 +53,6 @@ dependencies:
69
53
  requirements:
70
54
  - - ~>
71
55
  - !ruby/object:Gem::Version
72
- segments:
73
- - 1
74
- - 6
75
- - 0
76
56
  version: 1.6.0
77
57
  type: :development
78
58
  prerelease: false
@@ -84,8 +64,6 @@ dependencies:
84
64
  requirements:
85
65
  - - ">="
86
66
  - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
67
  version: "0"
90
68
  type: :development
91
69
  prerelease: false
@@ -128,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
106
  requirements:
129
107
  - - ">="
130
108
  - !ruby/object:Gem::Version
131
- hash: 3754027908622278514
109
+ hash: -147195388161263783
132
110
  segments:
133
111
  - 0
134
112
  version: "0"
@@ -137,13 +115,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
115
  requirements:
138
116
  - - ">="
139
117
  - !ruby/object:Gem::Version
140
- segments:
141
- - 0
142
118
  version: "0"
143
119
  requirements: []
144
120
 
145
121
  rubyforge_project:
146
- rubygems_version: 1.3.7
122
+ rubygems_version: 1.6.2
147
123
  signing_key:
148
124
  specification_version: 3
149
125
  summary: pickle_i18n support pickle internationalization