globalize 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjA4YjdiYjFmODI5ZjE4ZjVkMWU5NDRjOTZhNDRmODc1MDQwMzdmOQ==
5
- data.tar.gz: !binary |-
6
- YTY3NTk5N2ZjY2E4ODFiOGVjYTI2OGE0YzkxODMzOGU3OTU3OTA2MQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- Yzg0MWI0YTQzZTMwODMzZTdhMGZjYTZkZjJiMjQ0OTFlYjhjNWY5MzVlMTNi
10
- N2U3NTg1NmU3YWE3ZjAwMjJjNmNmMDM3NmYyNzU0ZTZiMTFiMjU0MTZkNzFi
11
- MmY3OTBhOGYwODIxNzgwYWU4NWRkY2Y4OTRhOWQyYWMyMDMzZmM=
12
- data.tar.gz: !binary |-
13
- OGE1NGU3NjY0MzRlZWJiYzU4OTRiN2NkMWRjOTlmMzAxMTUyYzkyMjgzMmM2
14
- YTM0MWE1ZWRiYWQ5ZjViNDhhOTQ0MzljN2JkNjE4OTFjN2Y0YzU2YmI5OWRi
15
- MjA1ZWFiYzJkZGU0YTkwZjc1ZDY1YWMxMTE5OTJhNGZmZWYyYzE=
2
+ SHA1:
3
+ metadata.gz: ece7db7c7ff689c0abebb00006d1fb5602e2ab7f
4
+ data.tar.gz: 68e728cdb2c0d847fc3b57e9e910288af2045f25
5
+ SHA512:
6
+ metadata.gz: a86baab1b896f424cd6406928676f191d6ae5996c47c596a5c24892240d9a0f496d0275c0d965a52918ea93bb4064aa08a2e08bfc9f21bb038fcf4e5c6fa5282
7
+ data.tar.gz: 12d69809f2783da9f9079001b748e449bc2718b57fe814b4661a633c9a7c27ad13503b64035644dc076e88828d77bf841aad1fa003b7a297859eb0df6f90a8de
data/CHANGELOG.md CHANGED
@@ -44,6 +44,13 @@
44
44
 
45
45
  * Initial release of Rails 4-compatible gem.
46
46
 
47
+ ## 3.1.0 (2014-1-25)
48
+
49
+ * Backport scope support on uniqueness validation from 4.0, drop support for ActiveRecord < 3.1, fixes [#324](https://github.com/globalize/globalize/issues/324).
50
+
51
+ ## 3.0.5 (2015-04-24)
52
+ * Now working properly with the squeel library. (thanks [Toru Mori](https://github.com/torumori)). See [#437](https://github.com/globalize/globalize/pull/437)
53
+
47
54
  ## 3.0.4 (2014-1-8)
48
55
  * Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
49
56
 
data/Gemfile.lock CHANGED
@@ -1,40 +1,41 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- globalize (3.0.3)
5
- activemodel (~> 3.0.0)
6
- activerecord (~> 3.0.0)
4
+ globalize (3.0.4)
5
+ activemodel (>= 3.0.0, < 4.0.0)
6
+ activerecord (>= 3.0.0, < 4.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (3.0.20)
12
- activesupport (= 3.0.20)
13
- builder (~> 2.1.2)
14
- i18n (~> 0.5.0)
15
- activerecord (3.0.20)
16
- activemodel (= 3.0.20)
17
- activesupport (= 3.0.20)
18
- arel (~> 2.0.10)
19
- tzinfo (~> 0.3.23)
20
- activesupport (3.0.20)
21
- arel (2.0.10)
22
- builder (2.1.2)
11
+ activemodel (3.2.21)
12
+ activesupport (= 3.2.21)
13
+ builder (~> 3.0.0)
14
+ activerecord (3.2.21)
15
+ activemodel (= 3.2.21)
16
+ activesupport (= 3.2.21)
17
+ arel (~> 3.0.2)
18
+ tzinfo (~> 0.3.29)
19
+ activesupport (3.2.21)
20
+ i18n (~> 0.6, >= 0.6.4)
21
+ multi_json (~> 1.0)
22
+ arel (3.0.3)
23
+ builder (3.0.4)
23
24
  database_cleaner (0.6.7)
24
25
  ffi2-generators (0.1.1)
25
26
  friendly_id (4.0.10.1)
26
27
  activerecord (>= 3.0, < 4.0)
27
- i18n (0.5.3)
28
- json (1.8.1)
29
- metaclass (0.0.1)
30
- minitest (4.7.5)
31
- mocha (0.14.0)
28
+ i18n (0.7.0)
29
+ metaclass (0.0.4)
30
+ minitest (5.5.1)
31
+ mocha (1.1.0)
32
32
  metaclass (~> 0.0.1)
33
+ multi_json (1.11.0)
33
34
  pathname_local (0.0.2)
34
- rake (10.1.1)
35
- rdoc (4.1.0)
36
- json (~> 1.4)
37
- rubysl (2.0.15)
35
+ power_assert (0.2.3)
36
+ rake (10.4.2)
37
+ rdoc (4.2.0)
38
+ rubysl (2.1.0)
38
39
  rubysl-abbrev (~> 2.0)
39
40
  rubysl-base64 (~> 2.0)
40
41
  rubysl-benchmark (~> 2.0)
@@ -68,7 +69,7 @@ GEM
68
69
  rubysl-io-nonblock (~> 2.0)
69
70
  rubysl-io-wait (~> 2.0)
70
71
  rubysl-ipaddr (~> 2.0)
71
- rubysl-irb (~> 2.0)
72
+ rubysl-irb (~> 2.1)
72
73
  rubysl-logger (~> 2.0)
73
74
  rubysl-mathn (~> 2.0)
74
75
  rubysl-matrix (~> 2.0)
@@ -97,7 +98,6 @@ GEM
97
98
  rubysl-pstore (~> 2.0)
98
99
  rubysl-pty (~> 2.0)
99
100
  rubysl-rational (~> 2.0)
100
- rubysl-readline (~> 2.0)
101
101
  rubysl-resolv (~> 2.0)
102
102
  rubysl-rexml (~> 2.0)
103
103
  rubysl-rinda (~> 2.0)
@@ -139,14 +139,14 @@ GEM
139
139
  rubysl-csv (2.0.2)
140
140
  rubysl-english (~> 2.0)
141
141
  rubysl-curses (2.0.1)
142
- rubysl-date (2.0.6)
142
+ rubysl-date (2.0.9)
143
143
  rubysl-delegate (2.0.1)
144
144
  rubysl-digest (2.0.3)
145
145
  rubysl-drb (2.0.1)
146
146
  rubysl-e2mmap (2.0.0)
147
147
  rubysl-english (2.0.0)
148
148
  rubysl-enumerator (2.0.0)
149
- rubysl-erb (2.0.1)
149
+ rubysl-erb (2.0.2)
150
150
  rubysl-etc (2.0.3)
151
151
  ffi2-generators (~> 0.1)
152
152
  rubysl-expect (2.0.0)
@@ -164,12 +164,11 @@ GEM
164
164
  rubysl-io-nonblock (2.0.0)
165
165
  rubysl-io-wait (2.0.0)
166
166
  rubysl-ipaddr (2.0.0)
167
- rubysl-irb (2.0.4)
167
+ rubysl-irb (2.1.1)
168
168
  rubysl-e2mmap (~> 2.0)
169
169
  rubysl-mathn (~> 2.0)
170
- rubysl-readline (~> 2.0)
171
170
  rubysl-thread (~> 2.0)
172
- rubysl-logger (2.0.0)
171
+ rubysl-logger (2.1.0)
173
172
  rubysl-mathn (2.0.0)
174
173
  rubysl-matrix (2.1.0)
175
174
  rubysl-e2mmap (~> 2.0)
@@ -192,22 +191,21 @@ GEM
192
191
  rubysl-observer (2.0.0)
193
192
  rubysl-open-uri (2.0.0)
194
193
  rubysl-open3 (2.0.0)
195
- rubysl-openssl (2.0.5)
194
+ rubysl-openssl (2.2.1)
196
195
  rubysl-optparse (2.0.1)
197
196
  rubysl-shellwords (~> 2.0)
198
197
  rubysl-ostruct (2.0.4)
199
- rubysl-pathname (2.0.0)
200
- rubysl-prettyprint (2.0.2)
198
+ rubysl-pathname (2.1.0)
199
+ rubysl-prettyprint (2.0.3)
201
200
  rubysl-prime (2.0.1)
202
201
  rubysl-profile (2.0.0)
203
202
  rubysl-profiler (2.0.1)
204
203
  rubysl-pstore (2.0.0)
205
- rubysl-pty (2.0.2)
204
+ rubysl-pty (2.0.3)
206
205
  rubysl-rational (2.0.1)
207
- rubysl-readline (2.0.2)
208
- rubysl-resolv (2.0.0)
209
- rubysl-rexml (2.0.2)
210
- rubysl-rinda (2.0.0)
206
+ rubysl-resolv (2.1.0)
207
+ rubysl-rexml (2.0.4)
208
+ rubysl-rinda (2.0.1)
211
209
  rubysl-rss (2.0.0)
212
210
  rubysl-scanf (2.0.0)
213
211
  rubysl-securerandom (2.0.0)
@@ -218,14 +216,14 @@ GEM
218
216
  rubysl-stringio (2.0.0)
219
217
  rubysl-strscan (2.0.0)
220
218
  rubysl-sync (2.0.0)
221
- rubysl-syslog (2.0.1)
219
+ rubysl-syslog (2.1.0)
222
220
  ffi2-generators (~> 0.1)
223
221
  rubysl-tempfile (2.0.1)
224
222
  rubysl-thread (2.0.2)
225
223
  rubysl-thwait (2.0.0)
226
224
  rubysl-time (2.0.3)
227
225
  rubysl-timeout (2.0.0)
228
- rubysl-tmpdir (2.0.0)
226
+ rubysl-tmpdir (2.0.1)
229
227
  rubysl-tsort (2.0.1)
230
228
  rubysl-un (2.0.0)
231
229
  rubysl-fileutils (~> 2.0)
@@ -234,12 +232,13 @@ GEM
234
232
  rubysl-weakref (2.0.0)
235
233
  rubysl-webrick (2.0.0)
236
234
  rubysl-xmlrpc (2.0.0)
237
- rubysl-yaml (2.0.4)
235
+ rubysl-yaml (2.1.0)
238
236
  rubysl-zlib (2.0.1)
239
- sqlite3 (1.3.8)
240
- test-unit (2.0.0.0)
237
+ sqlite3 (1.3.10)
238
+ test-unit (3.0.9)
239
+ power_assert
241
240
  test_declarative (0.0.5)
242
- tzinfo (0.3.38)
241
+ tzinfo (0.3.43)
243
242
 
244
243
  PLATFORMS
245
244
  ruby
data/globalize.gemspec ADDED
@@ -0,0 +1,54 @@
1
+ require File.expand_path('../lib/globalize/version', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'globalize'
5
+ s.version = Globalize::Version
6
+ s.authors = ['Sven Fuchs', 'Joshua Harvey', 'Clemens Kofler', 'John-Paul Bader', 'Tomasz Stachewicz', 'Philip Arndt', 'Chris Salzberg']
7
+ s.email = 'nobody@globalize-rails.org'
8
+ s.homepage = 'https://github.com/globalize/globalize'
9
+ s.summary = 'Rails I18n de-facto standard library for ActiveRecord model/data translation'
10
+ s.description = "#{s.summary}."
11
+ s.license = "MIT"
12
+
13
+ s.files = Dir['{lib/**/*,[A-Z]*}']
14
+ s.platform = Gem::Platform::RUBY
15
+ s.require_path = 'lib'
16
+
17
+ if ENV['RAILS_3_0']
18
+ s.add_dependency 'activerecord', '~> 3.0.0'
19
+ s.add_dependency 'activemodel', '~> 3.0.0'
20
+ elsif ENV['RAILS_3_1']
21
+ s.add_dependency 'activerecord', '~> 3.1.0'
22
+ s.add_dependency 'activemodel', '~> 3.1.0'
23
+ elsif ENV['RAILS_3_2']
24
+ s.add_dependency 'activerecord', '~> 3.2.0'
25
+ s.add_dependency 'activemodel', '~> 3.2.0'
26
+ else
27
+ # normal case
28
+ s.add_dependency 'activerecord', '>= 3.0.0', '< 4.0.0'
29
+ s.add_dependency 'activemodel', '>= 3.0.0', '< 4.0.0'
30
+ end
31
+
32
+ s.add_development_dependency 'database_cleaner', '~> 0.6.0'
33
+ s.add_development_dependency 'mocha'
34
+ s.add_development_dependency 'pathname_local'
35
+ s.add_development_dependency 'test_declarative'
36
+ s.add_development_dependency 'friendly_id'
37
+ s.add_development_dependency 'sqlite3'
38
+ s.add_development_dependency 'rake'
39
+ s.add_development_dependency 'rdoc'
40
+ s.post_install_message = <<-END
41
+
42
+ Globalize has extracted versioning support to a separate gem named
43
+ globalize-versioning. If you are using versioning (with paper_trail
44
+ or any other versioning gem), please add the line
45
+ "gem 'globalize-versioning'" to your Gemfile and go to the github
46
+ page at globalize/globalize-versioning if you encounter any problems.
47
+
48
+ Note that the globalize-versioning gem does not delegate versions to
49
+ the translation table, so you will have to update your syntax to
50
+ the form: `post.translation.versions`. See the globalize-versioning
51
+ readme for details.
52
+
53
+ END
54
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'globalize'
@@ -1,3 +1,3 @@
1
1
  module Globalize
2
- Version = '3.0.4'
2
+ Version = '3.0.5'
3
3
  end
@@ -31,7 +31,7 @@ ActiveRecord::Validations::UniquenessValidator.class_eval do
31
31
 
32
32
  sql, params = mount_sql_and_params(finder_class, table_name, attribute, value)
33
33
 
34
- relation = table.where(sql, *params).where(:locale => Globalize.locale)
34
+ relation = table.where(sql, *params).where(:locale => Globalize.locale.to_s)
35
35
 
36
36
  Array.wrap(options[:scope]).each do |scope_item|
37
37
  scope_value = record.send(scope_item)
data/readme.md ADDED
@@ -0,0 +1,312 @@
1
+ # Globalize [![Build Status](https://travis-ci.org/globalize/globalize.png?branch=3-0-stable)](https://travis-ci.org/globalize/globalize)
2
+
3
+ Globalize builds on the [I18n API in Ruby on Rails](http://guides.rubyonrails.org/i18n.html)
4
+ to add model translations to ActiveRecord models.
5
+
6
+ ## Requirements
7
+
8
+ * ActiveRecord > 4.0.0 (see below for installation with ActiveRecord 3.x)
9
+ * I18n
10
+
11
+ ## Installation
12
+
13
+ To install the ActiveRecord 4.x compatible version of Globalize with its default setup, just use:
14
+
15
+ ```ruby
16
+ gem install globalize
17
+ ```
18
+
19
+ When using bundler put this in your Gemfile:
20
+
21
+ ```ruby
22
+ gem 'globalize', '~> 4.0.0'
23
+ ```
24
+
25
+ To use the version of globalize for ActiveRecord 3.1 or 3.2, specify:
26
+
27
+ ````ruby
28
+ gem 'globalize', '~> 3.1.0'
29
+ ````
30
+
31
+ (If you are using ActiveRecord 3.0, use version 3.0: `gem 'globalize', '3.0.4'`.)
32
+
33
+ The [`3-1-stable` branch](https://github.com/globalize/globalize/tree/3-1-stable) of this repository corresponds to the latest ActiveRecord 3 version of globalize. Note that `globalize3` has been deprecated and you are encouraged to update your Gemfile accordingly.
34
+
35
+ ## Model translations
36
+
37
+ Model translations allow you to translate your models' attribute values. E.g.
38
+
39
+ ```ruby
40
+ class Post < ActiveRecord::Base
41
+ translates :title, :text
42
+ end
43
+ ```
44
+
45
+ Allows you to translate the attributes :title and :text per locale:
46
+
47
+ ```ruby
48
+ I18n.locale = :en
49
+ post.title # => Globalize rocks!
50
+
51
+ I18n.locale = :he
52
+ post.title # => גלובאלייז2 שולט!
53
+ ```
54
+
55
+ In order to make this work, you'll need to add the appropriate translation tables.
56
+ Globalize comes with a handy helper method to help you do this.
57
+ It's called `create_translation_table!`. Here's an example:
58
+
59
+ _Note that your migrations can use `create_translation_table!` and `drop_translation_table!`
60
+ only inside the `up` and `down` instance methods, respectively. You cannot use `create_translation_table!`
61
+ and `drop_translation_table!` inside the `change` instance method in Rails >= 3.1.0._
62
+
63
+ ### Rails 3.0
64
+
65
+ ```ruby
66
+ class CreatePosts < ActiveRecord::Migration
67
+ def self.up
68
+ create_table :posts do |t|
69
+ t.timestamps
70
+ end
71
+ Post.create_translation_table! :title => :string, :text => :text
72
+ end
73
+ def self.down
74
+ drop_table :posts
75
+ Post.drop_translation_table!
76
+ end
77
+ end
78
+ ```
79
+
80
+ ### Rails >= 3.1.0
81
+
82
+ ***Do not use the `change` method, use `up` and `down`!***
83
+
84
+ ```ruby
85
+ class CreatePosts < ActiveRecord::Migration
86
+ def up
87
+ create_table :posts do |t|
88
+ t.timestamps
89
+ end
90
+ Post.create_translation_table! :title => :string, :text => :text
91
+ end
92
+ def down
93
+ drop_table :posts
94
+ Post.drop_translation_table!
95
+ end
96
+ end
97
+ ```
98
+
99
+ Also, you can pass options for specific columns. Here’s an example:
100
+
101
+ ```ruby
102
+ class CreatePosts < ActiveRecord::Migration
103
+ def up
104
+ create_table :posts do |t|
105
+ t.timestamps
106
+ end
107
+ Post.create_translation_table! :title => :string,
108
+ :text => {:type => :text, :null => false, :default => 'abc'}
109
+ end
110
+ def down
111
+ drop_table :posts
112
+ Post.drop_translation_table!
113
+ end
114
+ end
115
+ ```
116
+
117
+ Note that the ActiveRecord model `Post` must already exist and have a `translates`
118
+ directive listing the translated fields.
119
+
120
+ ## Migrating existing data to and from the translated version
121
+
122
+ As well as creating a translation table, you can also use `create_translation_table!`
123
+ to migrate across any existing data to the default locale. This can also operate
124
+ in reverse to restore any translations from the default locale back to the model
125
+ when you don't want to use a translation table anymore using `drop_translation_table!`
126
+
127
+ This feature makes use of `untranslated_attributes` which allows access to the
128
+ model's attributes as they were before the translation was applied. Here's an
129
+ example (which assumes you already have a model called `Post` and its table
130
+ exists):
131
+
132
+ ```ruby
133
+ class TranslatePosts < ActiveRecord::Migration
134
+ def self.up
135
+ Post.create_translation_table!({
136
+ :title => :string,
137
+ :text => :text
138
+ }, {
139
+ :migrate_data => true
140
+ })
141
+ end
142
+
143
+ def self.down
144
+ Post.drop_translation_table! :migrate_data => true
145
+ end
146
+ end
147
+ ```
148
+
149
+ NOTE: Make sure you drop the translated columns from the parent table after all your data is safely migrated.
150
+
151
+ ## Versioning with Globalize
152
+
153
+ See the [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
154
+
155
+ ## I18n fallbacks for empty translations
156
+
157
+ It is possible to enable fallbacks for empty translations. It will depend on the
158
+ configuration setting you have set for I18n translations in your Rails config.
159
+
160
+ You can enable them by adding the next line to `config/application.rb` (or only
161
+ `config/environments/production.rb` if you only want them in production)
162
+
163
+ ```ruby
164
+ config.i18n.fallbacks = true
165
+ ```
166
+
167
+ By default, globalize will only use fallbacks when your translation model does
168
+ not exist or the translation value for the item you've requested is `nil`.
169
+ However it is possible to also use fallbacks for `blank` translations by adding
170
+ `:fallbacks_for_empty_translations => true` to the `translates` method.
171
+
172
+ ```ruby
173
+ class Post < ActiveRecord::Base
174
+ translates :title, :name
175
+ end
176
+
177
+ puts post.translations.inspect
178
+ # => [#<Post::Translation id: 1, post_id: 1, locale: "en", title: "Globalize rocks!", name: "Globalize">,
179
+ #<Post::Translation id: 2, post_id: 1, locale: "nl", title: '', name: nil>]
180
+
181
+ I18n.locale = :en
182
+ post.title # => 'Globalize rocks!'
183
+ post.name # => 'Globalize'
184
+
185
+ I18n.locale = :nl
186
+ post.title # => ''
187
+ post.name # => 'Globalize'
188
+ ```
189
+
190
+ ```ruby
191
+ class Post < ActiveRecord::Base
192
+ translates :title, :name, :fallbacks_for_empty_translations => true
193
+ end
194
+
195
+ puts post.translations.inspect
196
+ # => [#<Post::Translation id: 1, post_id: 1, locale: "en", title: "Globalize rocks!", name: "Globalize">,
197
+ #<Post::Translation id: 2, post_id: 1, locale: "nl", title: '', name: nil>]
198
+
199
+ I18n.locale = :en
200
+ post.title # => 'Globalize rocks!'
201
+ post.name # => 'Globalize'
202
+
203
+ I18n.locale = :nl
204
+ post.title # => 'Globalize rocks!'
205
+ post.name # => 'Globalize'
206
+ ```
207
+
208
+ ## Fallback locales to each other
209
+
210
+ It is possible to setup locales to fallback to each other.
211
+
212
+ ```ruby
213
+ class Post < ActiveRecord::Base
214
+ translates :title, :name
215
+ end
216
+
217
+ Globalize.fallbacks = {:en => [:en, :pl], :pl => [:pl, :en]}
218
+
219
+ I18n.locale = :en
220
+ en_post = Post.create(:title => 'en_title')
221
+
222
+ I18n.locale = :pl
223
+ pl_post = Post.create(:title => 'pl_title')
224
+ en_post.title # => 'en_title'
225
+
226
+ I18n.locale = :en
227
+ en_post.title # => 'en_title'
228
+ pl_post.title # => 'pl_title'
229
+ ```
230
+
231
+
232
+ ## Scoping objects by those with translations
233
+
234
+ To only return objects that have a translation for the given locale we can use
235
+ the `with_translations` scope. This will only return records that have a
236
+ translations for the passed in locale.
237
+
238
+ ```ruby
239
+ Post.with_translations('en')
240
+ # => [
241
+ #<Post::Translation id: 1, post_id: 1, locale: "en", title: "Globalize rocks!", name: "Globalize">,
242
+ #<Post::Translation id: 2, post_id: 1, locale: "nl", title: '', name: nil>
243
+ ]
244
+
245
+ Post.with_translations(I18n.locale)
246
+ # => [
247
+ #<Post::Translation id: 1, post_id: 1, locale: "en", title: "Globalize rocks!", name: "Globalize">,
248
+ #<Post::Translation id: 2, post_id: 1, locale: "nl", title: '', name: nil>
249
+ ]
250
+
251
+ Post.with_translations('de')
252
+ # => []
253
+ ```
254
+
255
+ ## Show different languages
256
+
257
+ In views, if there is content from different locales that you wish to display,
258
+ you should use the `with_locale` option with a block, as below:
259
+
260
+ ```erb
261
+ <% Globalize.with_locale(:en) do %>
262
+ <%= render "my_translated_partial" %>
263
+ <% end %>
264
+ ```
265
+
266
+ Your partial will now be rendered with the `:en` locale set as the current locale.
267
+
268
+ ## Interpolation
269
+
270
+ Globalize supports interpolation in a similar manner to I18n.
271
+
272
+ ```ruby
273
+ class Post < ActiveRecord::Base
274
+ translates :title
275
+ end
276
+
277
+ I18n.locale = :en
278
+ post.title = "Globalize %{superlative}!"
279
+
280
+ post.title
281
+ # #=> "Globalize %{superlative}!"
282
+
283
+ post.title(:foo => "bar")
284
+ # SomeError: missing interpolation argument :superlative
285
+
286
+ post.title(:superlative => "rocks")
287
+ # #=> "Globalize rocks!"
288
+ ```
289
+
290
+ ## Official Globalize extensions
291
+
292
+ * [globalize-accessors](https://github.com/globalize/globalize-accessors) - Replacement for [easy_globalize_3_accessors](https://github.com/paneq/easy_globalize3_accessors) compatible with Globalize 3.x and 4.x.
293
+ * [globalize-versioning](https://github.com/globalize/globalize-versioning) - Versioning support for using Globalize with [`paper_trail`](https://github.com/airblade/paper_trail).
294
+
295
+ ## Alternative Solutions
296
+
297
+ * [Veger's fork](http://github.com/veger/globalize2) - uses default AR schema for the default locale, delegates to the translations table for other locales only
298
+ * [TranslatableColumns](http://github.com/iain/translatable_columns) - have multiple languages of the same attribute in a model (Iain Hecker)
299
+ * [Traco](https://github.com/barsoom/traco) - A newer take on using multiple columns in the same model (Barsoom)
300
+ * [localized_record](http://github.com/glennpow/localized_record) - allows records to have localized attributes without any modifications to the database (Glenn Powell)
301
+ * [model_translations](http://github.com/janne/model_translations) - Minimal implementation of Globalize2 style model translations (Jan Andersson)
302
+ * [hstore_translate](http://github.com/robworley/hstore_translate) - Rails I18n library for ActiveRecord model/data translation using PostgreSQL's hstore datatype (Rob Worley)
303
+
304
+ ## Related solutions
305
+
306
+ * [globalize2_versioning](http://github.com/joshmh/globalize2_versioning) - acts_as_versioned style versioning for globalize2 (Joshua Harvey)
307
+ * [i18n_multi_locales_validations](http://github.com/ZenCocoon/i18n_multi_locales_validations) - multi-locales attributes validations to validates attributes from globalize2 translations models (Sébastien Grosjean)
308
+ * [globalize2 Demo App](http://github.com/svenfuchs/globalize2-demo) - demo application for globalize2 (Sven Fuchs)
309
+ * [migrate_from_globalize1](http://gist.github.com/120867) - migrate model translations from Globalize1 to globalize2 (Tomasz Stachewicz)
310
+ * [easy_globalize2_accessors](http://github.com/astropanic/easy_globalize2_accessors) - easily access (read and write) globalize2-translated fields (astropanic, Tomasz Stachewicz)
311
+ * [globalize2-easy-translate](http://github.com/bsamman/globalize2-easy-translate) - adds methods to easily access or set translated attributes to your model (bsamman)
312
+ * [batch_translations](http://github.com/rilla/batch_translations) - allow saving multiple globalize2 translations in the same request (Jose Alvarez Rilla)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -14,158 +14,158 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2014-01-09 00:00:00.000000000 Z
17
+ date: 2015-04-23 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activerecord
21
21
  requirement: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ! '>='
23
+ - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: 3.0.0
26
- - - <
26
+ - - "<"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 4.0.0
29
29
  type: :runtime
30
30
  prerelease: false
31
31
  version_requirements: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ! '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: 3.0.0
36
- - - <
36
+ - - "<"
37
37
  - !ruby/object:Gem::Version
38
38
  version: 4.0.0
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: activemodel
41
41
  requirement: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - ! '>='
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: 3.0.0
46
- - - <
46
+ - - "<"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 4.0.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 3.0.0
56
- - - <
56
+ - - "<"
57
57
  - !ruby/object:Gem::Version
58
58
  version: 4.0.0
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: database_cleaner
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - ~>
63
+ - - "~>"
64
64
  - !ruby/object:Gem::Version
65
65
  version: 0.6.0
66
66
  type: :development
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - ~>
70
+ - - "~>"
71
71
  - !ruby/object:Gem::Version
72
72
  version: 0.6.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: mocha
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ! '>='
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  type: :development
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ! '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: pathname_local
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ! '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ! '>='
98
+ - - ">="
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: test_declarative
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ! '>='
105
+ - - ">="
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - ! '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: friendly_id
117
117
  requirement: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - ! '>='
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ! '>='
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: sqlite3
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - ! '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - ! '>='
140
+ - - ">="
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: rake
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - ! '>='
147
+ - - ">="
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  type: :development
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - ! '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: rdoc
159
159
  requirement: !ruby/object:Gem::Requirement
160
160
  requirements:
161
- - - ! '>='
161
+ - - ">="
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  type: :development
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
167
167
  requirements:
168
- - - ! '>='
168
+ - - ">="
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  description: Rails I18n de-facto standard library for ActiveRecord model/data translation.
@@ -174,75 +174,69 @@ executables: []
174
174
  extensions: []
175
175
  extra_rdoc_files: []
176
176
  files:
177
- - lib/globalize/interpolation.rb
178
- - lib/globalize/version.rb
177
+ - CHANGELOG.md
178
+ - CONTRIBUTING.md
179
+ - Gemfile
180
+ - Gemfile.lock
181
+ - LICENSE
182
+ - Rakefile
183
+ - globalize.gemspec
184
+ - init.rb
185
+ - lib/globalize.rb
179
186
  - lib/globalize/active_record.rb
180
- - lib/globalize/active_record/attributes.rb
181
- - lib/globalize/active_record/instance_methods.rb
182
- - lib/globalize/active_record/adapter.rb
183
- - lib/globalize/active_record/translation.rb
184
187
  - lib/globalize/active_record/act_macro.rb
185
- - lib/globalize/active_record/exceptions.rb
186
- - lib/globalize/active_record/query_methods.rb
188
+ - lib/globalize/active_record/adapter.rb
189
+ - lib/globalize/active_record/attributes.rb
187
190
  - lib/globalize/active_record/class_methods.rb
191
+ - lib/globalize/active_record/exceptions.rb
192
+ - lib/globalize/active_record/instance_methods.rb
188
193
  - lib/globalize/active_record/migration.rb
189
- - lib/globalize.rb
190
- - lib/i18n/missing_translations_raise_handler.rb
194
+ - lib/globalize/active_record/query_methods.rb
195
+ - lib/globalize/active_record/translation.rb
196
+ - lib/globalize/interpolation.rb
197
+ - lib/globalize/version.rb
191
198
  - lib/i18n/missing_translations_log_handler.rb
192
- - lib/patches/active_record/uniqueness_validator.rb
199
+ - lib/i18n/missing_translations_raise_handler.rb
193
200
  - lib/patches/active_record/query_method.rb
201
+ - lib/patches/active_record/uniqueness_validator.rb
194
202
  - lib/patches/active_record/xml_attribute_serializer.rb
195
203
  - lib/patches/i18n/interpolate.rb
196
- - CONTRIBUTING.md
197
- - Gemfile.lock
198
- - CHANGELOG.md
199
- - LICENSE
200
- - Rakefile
201
- - Gemfile
204
+ - readme.md
202
205
  homepage: https://github.com/globalize/globalize
203
206
  licenses:
204
207
  - MIT
205
208
  metadata: {}
206
- post_install_message: ! '
209
+ post_install_message: |2+
207
210
 
208
211
  Globalize has extracted versioning support to a separate gem named
209
-
210
212
  globalize-versioning. If you are using versioning (with paper_trail
211
-
212
213
  or any other versioning gem), please add the line
213
-
214
- "gem ''globalize-versioning''" to your Gemfile and go to the github
215
-
214
+ "gem 'globalize-versioning'" to your Gemfile and go to the github
216
215
  page at globalize/globalize-versioning if you encounter any problems.
217
216
 
218
-
219
217
  Note that the globalize-versioning gem does not delegate versions to
220
-
221
218
  the translation table, so you will have to update your syntax to
222
-
223
219
  the form: `post.translation.versions`. See the globalize-versioning
224
-
225
220
  readme for details.
226
221
 
227
-
228
- '
229
222
  rdoc_options: []
230
223
  require_paths:
231
224
  - lib
232
225
  required_ruby_version: !ruby/object:Gem::Requirement
233
226
  requirements:
234
- - - ! '>='
227
+ - - ">="
235
228
  - !ruby/object:Gem::Version
236
229
  version: '0'
237
230
  required_rubygems_version: !ruby/object:Gem::Requirement
238
231
  requirements:
239
- - - ! '>='
232
+ - - ">="
240
233
  - !ruby/object:Gem::Version
241
234
  version: '0'
242
235
  requirements: []
243
236
  rubyforge_project:
244
- rubygems_version: 2.0.5
237
+ rubygems_version: 2.4.6
245
238
  signing_key:
246
239
  specification_version: 4
247
240
  summary: Rails I18n de-facto standard library for ActiveRecord model/data translation
248
241
  test_files: []
242
+ has_rdoc: