embedded_localization 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 95cce5c93cc2a40e4e7334419076e952c83175ab
4
- data.tar.gz: ebc2c99e70b2ede69842b91dc233b259fe6e2f80
2
+ SHA256:
3
+ metadata.gz: cd7d580c4ee09bcfee5042cb602136f648624872fe79ed40a537eaa651886e1c
4
+ data.tar.gz: 813164fda35ac65c363e5ad9770772206fe1a14c35193a1ce2ab4f6d46eea236
5
5
  SHA512:
6
- metadata.gz: 26548d160a1ef5802e7f60a75944fcb60abe854c7d14175f63ac7e3fa9a5f1f7cc6feb5d9dfd74a10bd79d5d1c57f1f7a48787f1725b97bf8c91d888ca76024f
7
- data.tar.gz: 20211e8d9d86da99ce2ce539d6c4aa0a8ab2b1be8045e7a8897f73e48b31367cc9dc2af214957eb610edb3d843e536174c954d7ababb2bd2b05c23bb5200e42f
6
+ metadata.gz: '095d7057199cbc125a9a3d9a22b7b631d26befd029f6cf141f92ff2429c0e4506b1d1443589556773e470e90ef6ab4822e74cfe200c6f820ee8ecfeda48d4de4'
7
+ data.tar.gz: acc491dc55b119851478ad65b6fdf754a081f84dc6cfc7021ae83b5c51fbf44d555ec7492e8a693ed9dc9cffb4d3f72f77fac3d915659625658b6af9face38fc
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ #*#
1
2
  *~
2
3
  *.bak
3
4
  *.gem
data/.travis.yml CHANGED
@@ -1,22 +1,30 @@
1
1
  language: ruby
2
2
  bundler_args: --without development
3
- rvm:
4
- - 2.1.10
5
- - 2.2.8
6
- - 2.3.5
7
- - 2.4.2
8
- - ruby-head
9
- - jruby-head
10
- - rbx
11
- - ree
12
- env: JRUBY_OPTS="--server -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -J-Xms512m -J-Xmx1024m"
3
+ before_install:
4
+ - gem install bundler
5
+ - gem update --system
6
+
13
7
  matrix:
14
- allow_failures:
15
- - rbx
8
+ include:
9
+ - rvm: 2.2.10
10
+ - rvm: 2.3.8
11
+ - rvm: 2.4.10
12
+ - rvm: 2.5.8
13
+ - rvm: 2.6.9
14
+ - rvm: 2.7.5
15
+ - rvm: 3.0.3
16
+ - rvm: 3.1.0
17
+ - rvm: jruby-9.2.19.0
18
+ - rvm: jruby-9.3.3.0
19
+ - jruby-head
20
+ - mruby
21
+ - rubinius
22
+ - ree
23
+
24
+ env:
25
+ - JRUBY_OPTS="--server -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -J-Xms512m -J-Xmx1024m"
16
26
  - rvm: ruby-head
17
- - rvm: jruby-head
18
- - rvm: ree
19
- - rvm: jruby-19mode
27
+
20
28
  branches:
21
29
  only:
22
30
  - master
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/tilo/embedded_localization.png?branch=master)](http://travis-ci.org/tilo/embedded_localization) [![Gem Version](https://badge.fury.io/rb/embedded_localization.svg)](http://badge.fury.io/rb/embedded_localization)
4
4
 
5
- `embedded_localization` is compatible with Rails 3 and Rails 4, and adds model translations to ActiveRecord. `embedded_localization` is compatible with and builds on the new [I18n API in Ruby on Rails](http://guides.rubyonrails.org/i18n.html)
5
+ `embedded_localization` is compatible with Rails 3.x, 4.x and Rails 5.x, and adds model translations to ActiveRecord. `embedded_localization` is compatible with and builds on the new [I18n API in Ruby on Rails](http://guides.rubyonrails.org/i18n.html)
6
6
 
7
7
  `embedded_localization` is very lightweight, and allows you to transparently store translations of attributes right inside each record — no extra database tables needed to store the localization data! Make sure that your database default encoding is UTF-8 or UFT-16.
8
8
 
@@ -11,10 +11,21 @@ Model translations with `embedded_localization` use default ActiveRecord feature
11
11
  On top of that, you also get tools for checking into which locales an attribute was translated to, as well as for checking overall translation coverage.
12
12
 
13
13
 
14
+ ## Motivation
15
+
16
+ One real-life scenario is that you have a SaaS system which needs custom text for each company, which also needs to be translated in to several languages. Another scenario is that you have dynamic content that needs to be translated.
17
+
18
+ A recent project needed some localization support for ActiveRecord model data, but I did not want to clutter the schema with one additional table for each translated model, as the globalize gem requires. A second requirement was to allow SQL queries of the fields using the default locale.
19
+
20
+ The advantage of EmbeddedLocalization is that it does not need extra tables, and therefore no joins or additional table lookups to get to the translated data.
21
+
22
+ If your requirements are different, this approach might not work for you. In that case, I recommend to look at the alternative solutions listed at the bottom of this page.
23
+
24
+
14
25
  ## Requirements
15
26
 
16
- * ActiveRecord > 3.0.0.rc # Tested with Rails 5.1, 5,0, 4.2, 4.0.2, 3.2.18, 3.2.2
17
- * I18n
27
+ * ActiveRecord >= 3
28
+ * [I18n](http://guides.rubyonrails.org/i18n.html)
18
29
 
19
30
  ## Installation
20
31
 
@@ -301,14 +312,6 @@ For a new empty record, this will be empty.
301
312
  g.set_localized_attribute(:name, :de, "Science-Fiction")
302
313
  # => "Science-Fiction"
303
314
 
304
- ## Motivation
305
-
306
- A recent project needed some localization support for ActiveRecord model data, but I did not want to clutter the schema with one additional table for each translated model, as globalization3 requires. A second requirement was to allow SQL queries of the fields using the default locale.
307
-
308
- The advantage of EmbeddedLocalization is that it does not need extra tables, and therefore no joins or additional table lookups to get to the translated data.
309
-
310
- If your requirements are different, my approach might not work for you. In that case, I recommend to look at the alternative solutions listed below.
311
-
312
315
  ## Changes
313
316
 
314
317
  ### 1.2.0 (2017-11-10)
@@ -358,7 +361,7 @@ If your requirements are different, my approach might not work for you. In that
358
361
  ## Alternative Solutions
359
362
 
360
363
  * [Mongoid](https://github.com/mongoid/mongoid) - awesome Ruby ORM for MongoDB, which includes in-table localization of attributes (mongoid >= 2.3.0)
361
- * [Globalize3](https://github.com/svenfuchs/globalize3) - is an awesome gem, but different approach with more tables in the schema.
364
+ * [Globalize](https://github.com/globalize/globalize) - is an awesome gem, but different approach with more tables in the schema.
362
365
  * [Veger's fork of Globalize2](http://github.com/veger/globalize2) - uses default AR schema for the default locale, delegates to the translations table for other locales only
363
366
  * [TranslatableColumns](http://github.com/iain/translatable_columns) - have multiple languages of the same attribute in a model (Iain Hecker)
364
367
  * [localized_record](http://github.com/glennpow/localized_record) - allows records to have localized attributes without any modifications to the database (Glenn Powell)
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ RSpec::Core::RakeTask.new do |t|
11
11
  end
12
12
 
13
13
  desc "Run specs for all test cases"
14
- task :spec_all do
14
+ task :spec_all do
15
15
  system "rake spec"
16
16
  end
17
17
 
@@ -8,11 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Tilo Sloboda"]
9
9
  s.email = ["tilo.sloboda@gmail.com"]
10
10
  s.homepage = "https://github.com/tilo/embedded_localization"
11
- s.summary = %q{Rails I18n: library for embedded ActiveRecord 3 model/data translation}
12
- s.description = %q{Rails I18n: Embedded_Localization for ActiveRecord 3 is very lightweight, and allows you to transparently store translations of attributes right inside each record -- no extra database tables needed to store the localization data!}
13
-
14
- # s.rubyforge_project = "embedded_localization"
15
- s.rubyforge_project = "[none]"
11
+ s.summary = %q{Rails I18n: library for embedded ActiveRecord model/data translation}
12
+ s.description = %q{Rails I18n: Embedded_Localization for ActiveRecord is very lightweight, and allows you to transparently store translations of attributes right inside each record -- no extra database tables needed to store the localization data!}
16
13
 
17
14
  # s.platform = Gem::Platform::RUBY
18
15
 
@@ -23,7 +20,7 @@ Gem::Specification.new do |s|
23
20
  s.licenses = ['MIT','GPL-2']
24
21
  # specify any dependencies here; for example:
25
22
  s.add_development_dependency "rspec"
26
- s.add_development_dependency "activerecord", "~> 4.0.0"
23
+ s.add_development_dependency "activerecord", "~> 5.1"
27
24
  s.add_development_dependency "i18n"
28
25
  s.add_development_dependency "sqlite3"
29
26
  # s.add_runtime_dependency "rest-client"
@@ -5,8 +5,8 @@ module EmbeddedLocalization
5
5
  return if translates? # cludge to make sure we don't set this up twice..
6
6
 
7
7
  # for details about I18n fallbacks, check the source:
8
- # i18n-0.6.0/lib/i18n/backend/fallbacks.rb
9
- # i18n-0.6.0/lib/i18n/locale/fallbacks.rb
8
+ # i18n-0.9.0/lib/i18n/backend/fallbacks.rb
9
+ # i18n-0.9.0/lib/i18n/locale/fallbacks.rb
10
10
 
11
11
  # options[:fallbacks] => true or false # not used at this time
12
12
  options = attr_names.extract_options!
@@ -1,3 +1,3 @@
1
1
  module EmbeddedLocalization
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.2'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  class Hash
2
- def self.zip(keys,values) # from Facets of Ruby library
2
+ def self.zip(keys,values) # from Facets of Ruby library, CREDIT: Trans, Ara T. Howard
3
3
  h = {}
4
4
  keys.size.times{ |i| h[ keys[i] ] = values[i] }
5
5
  h
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embedded_localization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilo Sloboda
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-10 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: '5.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: '5.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: i18n
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: 'Rails I18n: Embedded_Localization for ActiveRecord 3 is very lightweight,
69
+ description: 'Rails I18n: Embedded_Localization for ActiveRecord is very lightweight,
70
70
  and allows you to transparently store translations of attributes right inside each
71
71
  record -- no extra database tables needed to store the localization data!'
72
72
  email:
@@ -99,7 +99,7 @@ licenses:
99
99
  - MIT
100
100
  - GPL-2
101
101
  metadata: {}
102
- post_install_message:
102
+ post_install_message:
103
103
  rdoc_options: []
104
104
  require_paths:
105
105
  - lib
@@ -114,11 +114,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubyforge_project: "[none]"
118
- rubygems_version: 2.6.13
119
- signing_key:
117
+ rubygems_version: 3.1.6
118
+ signing_key:
120
119
  specification_version: 4
121
- summary: 'Rails I18n: library for embedded ActiveRecord 3 model/data translation'
120
+ summary: 'Rails I18n: library for embedded ActiveRecord model/data translation'
122
121
  test_files:
123
122
  - spec/embedded_localization/native_column_spec.rb
124
123
  - spec/embedded_localization/simple_model_spec.rb