acts_as_translated 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 992b087e031776713de360952b84f7cdda2c4457
4
- data.tar.gz: 46a5d433edd5429b190d34efafc25ae045bcbea7
3
+ metadata.gz: fba9741ef4c95f297fdff85c20f1cdcaba30d54b
4
+ data.tar.gz: 033b67e19a3c1400c040d01ed53b789fc3910acb
5
5
  SHA512:
6
- metadata.gz: 67a506bca487c1b6967a9a769b84edaf6bd83a3975a06becdff13a632fef94ae8569a2ebbebf05b2ccedb0c7c8db83db2032d6eb556a98135e06922e7833bc05
7
- data.tar.gz: 58b936dc865c9d7eacd80fa85aed97e64b1b9ab7e7e6b396fd2fcd9ce7a3c7cfd24e04eee6f4c26e2b4c2dd525857c1976d3162f90d81f02be25030e2db3a7d9
6
+ metadata.gz: f4902685d1825bf2b2df9041790c4dfcf2862cbbc11810e1bba9ea23ddb58df08f091bdb3377fee60532293c2c88806d9d0658f054fee31d80b7c4e81e8a61c7
7
+ data.tar.gz: ca6349c9769ff0334294fb50301b1d417b6ceac1b43088a92b47b03d323a0dd18c4cadd3c72662c03792f4af4f2581eeafac00fafa388100b16e2740b6dc5201
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.7
5
+ - 2.2.3
data/README.md CHANGED
@@ -1,8 +1,23 @@
1
1
  # ActsAsTranslated
2
2
 
3
- This acts_as extension allows easy attribute translation. The gem uses the current I18n.locale to return the translated attribute.
3
+ [![Build Status](https://travis-ci.org/stijnster/acts_as_translated.svg?branch=master)](https://travis-ci.org/stijnster/acts_as_translated)
4
+ [![Gem Version](https://badge.fury.io/rb/acts_as_translated.svg)](http://badge.fury.io/rb/acts_as_translated)
4
5
 
5
- ## Examples
6
+ ActsAsTranslated is a gem for easy attribute translation. It works with localized versions of an attribute and switches between the localized version, using the I18n.locale setting.
7
+
8
+ ## Setup
9
+
10
+ In your bundler Gemfile
11
+
12
+ ```
13
+ gem 'acts_as_translated', '~> 1.0'
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Create localized attributes on your model by extending the attribute with the locale.
19
+
20
+ ### Data model
6
21
 
7
22
  Your migration file should look like this;
8
23
 
@@ -16,28 +31,43 @@ create_table :countries do |t|
16
31
  end
17
32
  ```
18
33
 
34
+ ### Class
35
+
19
36
  Create a class;
20
37
 
21
38
  ```
22
39
  class Country < ActiveRecord::Base
23
40
 
24
- acts_as_translated :name # optional, pass in default fallback locale; default: :nl
41
+ acts_as_translated :name
25
42
 
26
43
  end
27
44
  ```
28
45
 
29
- Use it in your views, controllers, ...
46
+ ### Use the localised version
47
+
48
+ Use it in your views, controllers, ... Use the non-localized version of the attribute (in this case "name").
30
49
 
31
50
  ```
32
- <% Country.all.each do |country| %>
51
+ <% if @country = Country.first %>
33
52
  <%= country.name %>
34
53
  <% end %>
35
54
  ```
36
55
 
37
- In your bundler Gemfile
56
+ ### Multiple attributes
57
+
58
+ Combine multiple attributes at once when specifying localized attributes;
38
59
 
39
60
  ```
40
- gem 'acts_as_translated', '~> 1.0'
61
+ acts_as_translated :name, :description
62
+ ```
63
+
64
+ ### Using defaults
65
+
66
+ By default, the gem defaults back to english, but you can specify another default
67
+
68
+ ```
69
+ acts_as_translated :slug
70
+ acts_as_translated :name, :description, default: :fr
41
71
  ```
42
72
 
43
73
  ## Deprication warnings
@@ -64,6 +94,6 @@ end
64
94
 
65
95
  ## History
66
96
 
67
- I've started development on this gem in 2008, way before I18n was considered the de-facto standard gem for internationalising a Ruby or Ruby-on-Rails app.
97
+ I've started development on this gem in 2008, way before I18n was considered the de-facto standard gem for internationalising a Ruby or Ruby-on-Rails app. The gem originated as a lib file and eventually made its way into a gem as the code was being used in multiple projects.
68
98
 
69
99
  The gem has been available for a few years now and serves in various production code.
@@ -3,25 +3,25 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
  require 'acts_as_translated/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'acts_as_translated'
7
- spec.version = ActsAsTranslated::VERSION
8
- spec.authors = [ 'Stijn Mathysen' ]
9
- spec.email = [ 'stijn@skylight.be' ]
10
- spec.summary = 'This acts_as extension allows easy attribute translation.'
11
- spec.homepage = 'https://github.com/stijnster/acts_as_translated'
12
- spec.license = 'MIT'
13
- spec.description = 'ActsAsTranslated is an acts_as for ActiveRecord that allows easy attribute translation.'
6
+ spec.name = 'acts_as_translated'
7
+ spec.version = ActsAsTranslated::VERSION
8
+ spec.authors = [ 'Stijn Mathysen' ]
9
+ spec.email = [ 'stijn@skylight.be' ]
10
+ spec.summary = 'This acts_as extension allows easy attribute translation.'
11
+ spec.homepage = 'https://github.com/stijnster/acts_as_translated'
12
+ spec.license = 'MIT'
13
+ spec.description = 'ActsAsTranslated is an acts_as for ActiveRecord that allows easy attribute translation.'
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = [ 'lib' ]
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = [ 'lib' ]
19
19
 
20
- spec.platform = Gem::Platform::RUBY
20
+ spec.required_ruby_version = '~> 2.0'
21
21
 
22
22
  spec.add_dependency 'activerecord', '>= 3.0.0'
23
23
 
24
- spec.add_development_dependency 'sqlite3', '~> 0'
24
+ spec.add_development_dependency 'sqlite3', '~> 1.3.6'
25
25
  spec.add_development_dependency 'rake', '~> 0'
26
26
  spec.add_development_dependency 'minitest', '~> 5.8'
27
27
  end
@@ -1,5 +1,5 @@
1
1
  module ActsAsTranslated
2
2
 
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_translated
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stijn Mathysen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-18 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.3.6
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: '0'
40
+ version: 1.3.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - ".travis.yml"
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md
@@ -95,9 +96,9 @@ require_paths:
95
96
  - lib
96
97
  required_ruby_version: !ruby/object:Gem::Requirement
97
98
  requirements:
98
- - - ">="
99
+ - - "~>"
99
100
  - !ruby/object:Gem::Version
100
- version: '0'
101
+ version: '2.0'
101
102
  required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  requirements:
103
104
  - - ">="
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  version: '0'
106
107
  requirements: []
107
108
  rubyforge_project:
108
- rubygems_version: 2.2.2
109
+ rubygems_version: 2.4.5.1
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: This acts_as extension allows easy attribute translation.