gettext_i18n_rails 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "appraisal"
6
+ gem "haml"
7
+ gem "slim"
8
+ gem "hamlet"
9
+ gem "ruby_parser"
10
+ gem "gettext", "2.3.1"
11
+ gem "sqlite3", "~>1.3.6"
12
+ gem "rake"
13
+ gem "rspec", "~>2"
14
+ gem "rails", "~>3.1.0"
15
+
16
+ gemspec :path=>"../"
@@ -0,0 +1,130 @@
1
+ PATH
2
+ remote: /Users/mgrosser/code/tools/gettext_i18n_rails
3
+ specs:
4
+ gettext_i18n_rails (0.7.1)
5
+ fast_gettext (>= 0.4.8)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.1.8)
11
+ actionpack (= 3.1.8)
12
+ mail (~> 2.3.3)
13
+ actionpack (3.1.8)
14
+ activemodel (= 3.1.8)
15
+ activesupport (= 3.1.8)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ i18n (~> 0.6)
19
+ rack (~> 1.3.6)
20
+ rack-cache (~> 1.2)
21
+ rack-mount (~> 0.8.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.0.4)
24
+ activemodel (3.1.8)
25
+ activesupport (= 3.1.8)
26
+ builder (~> 3.0.0)
27
+ i18n (~> 0.6)
28
+ activerecord (3.1.8)
29
+ activemodel (= 3.1.8)
30
+ activesupport (= 3.1.8)
31
+ arel (~> 2.2.3)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.1.8)
34
+ activemodel (= 3.1.8)
35
+ activesupport (= 3.1.8)
36
+ activesupport (3.1.8)
37
+ multi_json (>= 1.0, < 1.3)
38
+ appraisal (0.5.1)
39
+ bundler
40
+ rake
41
+ arel (2.2.3)
42
+ builder (3.0.4)
43
+ diff-lcs (1.1.3)
44
+ erubis (2.7.0)
45
+ fast_gettext (0.6.11)
46
+ gettext (2.3.1)
47
+ locale
48
+ haml (3.1.7)
49
+ hamlet (0.5.0.1)
50
+ slim (~> 1.0.0)
51
+ hike (1.2.1)
52
+ i18n (0.6.1)
53
+ json (1.7.5)
54
+ locale (2.0.8)
55
+ mail (2.3.3)
56
+ i18n (>= 0.4.0)
57
+ mime-types (~> 1.16)
58
+ treetop (~> 1.4.8)
59
+ mime-types (1.19)
60
+ multi_json (1.2.0)
61
+ polyglot (0.3.3)
62
+ rack (1.3.6)
63
+ rack-cache (1.2)
64
+ rack (>= 0.4)
65
+ rack-mount (0.8.3)
66
+ rack (>= 1.0.0)
67
+ rack-ssl (1.3.2)
68
+ rack
69
+ rack-test (0.6.2)
70
+ rack (>= 1.0)
71
+ rails (3.1.8)
72
+ actionmailer (= 3.1.8)
73
+ actionpack (= 3.1.8)
74
+ activerecord (= 3.1.8)
75
+ activeresource (= 3.1.8)
76
+ activesupport (= 3.1.8)
77
+ bundler (~> 1.0)
78
+ railties (= 3.1.8)
79
+ railties (3.1.8)
80
+ actionpack (= 3.1.8)
81
+ activesupport (= 3.1.8)
82
+ rack-ssl (~> 1.3.2)
83
+ rake (>= 0.8.7)
84
+ rdoc (~> 3.4)
85
+ thor (~> 0.14.6)
86
+ rake (0.9.2.2)
87
+ rdoc (3.12)
88
+ json (~> 1.4)
89
+ rspec (2.11.0)
90
+ rspec-core (~> 2.11.0)
91
+ rspec-expectations (~> 2.11.0)
92
+ rspec-mocks (~> 2.11.0)
93
+ rspec-core (2.11.1)
94
+ rspec-expectations (2.11.3)
95
+ diff-lcs (~> 1.1.3)
96
+ rspec-mocks (2.11.3)
97
+ ruby_parser (3.0.1)
98
+ sexp_processor (~> 4.1)
99
+ sexp_processor (4.1.2)
100
+ slim (1.0.4)
101
+ temple (~> 0.3.4)
102
+ tilt (~> 1.3.2)
103
+ sprockets (2.0.4)
104
+ hike (~> 1.2)
105
+ rack (~> 1.0)
106
+ tilt (~> 1.1, != 1.3.0)
107
+ sqlite3 (1.3.6)
108
+ temple (0.3.5)
109
+ thor (0.14.6)
110
+ tilt (1.3.3)
111
+ treetop (1.4.12)
112
+ polyglot
113
+ polyglot (>= 0.3.1)
114
+ tzinfo (0.3.35)
115
+
116
+ PLATFORMS
117
+ ruby
118
+
119
+ DEPENDENCIES
120
+ appraisal
121
+ gettext (= 2.3.1)
122
+ gettext_i18n_rails!
123
+ haml
124
+ hamlet
125
+ rails (~> 3.1.0)
126
+ rake
127
+ rspec (~> 2)
128
+ ruby_parser
129
+ slim
130
+ sqlite3 (~> 1.3.6)
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "appraisal"
6
+ gem "haml"
7
+ gem "slim"
8
+ gem "hamlet"
9
+ gem "ruby_parser"
10
+ gem "gettext", "2.3.1"
11
+ gem "sqlite3", "~>1.3.6"
12
+ gem "rake"
13
+ gem "rspec", "~>2"
14
+ gem "rails", "~>3.2.0"
15
+
16
+ gemspec :path=>"../"
@@ -0,0 +1,128 @@
1
+ PATH
2
+ remote: /Users/mgrosser/code/tools/gettext_i18n_rails
3
+ specs:
4
+ gettext_i18n_rails (0.7.1)
5
+ fast_gettext (>= 0.4.8)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.8)
11
+ actionpack (= 3.2.8)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.8)
14
+ activemodel (= 3.2.8)
15
+ activesupport (= 3.2.8)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.3)
23
+ activemodel (3.2.8)
24
+ activesupport (= 3.2.8)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.8)
27
+ activemodel (= 3.2.8)
28
+ activesupport (= 3.2.8)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.8)
32
+ activemodel (= 3.2.8)
33
+ activesupport (= 3.2.8)
34
+ activesupport (3.2.8)
35
+ i18n (~> 0.6)
36
+ multi_json (~> 1.0)
37
+ appraisal (0.5.1)
38
+ bundler
39
+ rake
40
+ arel (3.0.2)
41
+ builder (3.0.4)
42
+ diff-lcs (1.1.3)
43
+ erubis (2.7.0)
44
+ fast_gettext (0.6.11)
45
+ gettext (2.3.1)
46
+ locale
47
+ haml (3.1.7)
48
+ hamlet (0.5.0.1)
49
+ slim (~> 1.0.0)
50
+ hike (1.2.1)
51
+ i18n (0.6.1)
52
+ journey (1.0.4)
53
+ json (1.7.5)
54
+ locale (2.0.8)
55
+ mail (2.4.4)
56
+ i18n (>= 0.4.0)
57
+ mime-types (~> 1.16)
58
+ treetop (~> 1.4.8)
59
+ mime-types (1.19)
60
+ multi_json (1.3.7)
61
+ polyglot (0.3.3)
62
+ rack (1.4.1)
63
+ rack-cache (1.2)
64
+ rack (>= 0.4)
65
+ rack-ssl (1.3.2)
66
+ rack
67
+ rack-test (0.6.2)
68
+ rack (>= 1.0)
69
+ rails (3.2.8)
70
+ actionmailer (= 3.2.8)
71
+ actionpack (= 3.2.8)
72
+ activerecord (= 3.2.8)
73
+ activeresource (= 3.2.8)
74
+ activesupport (= 3.2.8)
75
+ bundler (~> 1.0)
76
+ railties (= 3.2.8)
77
+ railties (3.2.8)
78
+ actionpack (= 3.2.8)
79
+ activesupport (= 3.2.8)
80
+ rack-ssl (~> 1.3.2)
81
+ rake (>= 0.8.7)
82
+ rdoc (~> 3.4)
83
+ thor (>= 0.14.6, < 2.0)
84
+ rake (0.9.2.2)
85
+ rdoc (3.12)
86
+ json (~> 1.4)
87
+ rspec (2.11.0)
88
+ rspec-core (~> 2.11.0)
89
+ rspec-expectations (~> 2.11.0)
90
+ rspec-mocks (~> 2.11.0)
91
+ rspec-core (2.11.1)
92
+ rspec-expectations (2.11.3)
93
+ diff-lcs (~> 1.1.3)
94
+ rspec-mocks (2.11.3)
95
+ ruby_parser (3.0.1)
96
+ sexp_processor (~> 4.1)
97
+ sexp_processor (4.1.2)
98
+ slim (1.0.4)
99
+ temple (~> 0.3.4)
100
+ tilt (~> 1.3.2)
101
+ sprockets (2.1.3)
102
+ hike (~> 1.2)
103
+ rack (~> 1.0)
104
+ tilt (~> 1.1, != 1.3.0)
105
+ sqlite3 (1.3.6)
106
+ temple (0.3.5)
107
+ thor (0.16.0)
108
+ tilt (1.3.3)
109
+ treetop (1.4.12)
110
+ polyglot
111
+ polyglot (>= 0.3.1)
112
+ tzinfo (0.3.35)
113
+
114
+ PLATFORMS
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ appraisal
119
+ gettext (= 2.3.1)
120
+ gettext_i18n_rails!
121
+ haml
122
+ hamlet
123
+ rails (~> 3.2.0)
124
+ rake
125
+ rspec (~> 2)
126
+ ruby_parser
127
+ slim
128
+ sqlite3 (~> 1.3.6)
@@ -56,7 +56,8 @@ module GettextI18nRails
56
56
  I18n::Backend::Base::RESERVED_KEYS
57
57
  end
58
58
 
59
- string % values.except(*reserved_keys)
59
+ options = values.except(*reserved_keys)
60
+ options.any? ? (string % options) : string
60
61
  else
61
62
  string
62
63
  end
@@ -1,3 +1,3 @@
1
1
  module GettextI18nRails
2
- Version = VERSION = '0.7.1'
2
+ Version = VERSION = '0.7.2'
3
3
  end
@@ -4,6 +4,10 @@ require "spec_helper"
4
4
  FastGettext.silence_errors
5
5
 
6
6
  describe GettextI18nRails::Backend do
7
+ before do
8
+ FastGettext.current_cache = {}
9
+ end
10
+
7
11
  it "redirects calls to another I18n backend" do
8
12
  subject.backend.should_receive(:xxx).with(1,2)
9
13
  subject.xxx(1,2)
@@ -23,42 +27,47 @@ describe GettextI18nRails::Backend do
23
27
 
24
28
  describe :translate do
25
29
  it "uses gettext when the key is translatable" do
26
- FastGettext.stub(:current_repository).and_return 'xy.z.u'=>'a'
30
+ FastGettext.should_receive(:current_repository).and_return 'xy.z.u'=>'a'
27
31
  subject.translate('xx','u',:scope=>['xy','z']).should == 'a'
28
32
  end
29
33
 
30
34
  it "interpolates options" do
31
- FastGettext.stub(:current_repository).and_return 'ab.c'=>'a%{a}b'
35
+ FastGettext.should_receive(:current_repository).and_return 'ab.c'=>'a%{a}b'
32
36
  subject.translate('xx','c',:scope=>['ab'], :a => 'X').should == 'aXb'
33
37
  end
34
38
 
39
+ it "will not try and interpolate when there are no options given" do
40
+ FastGettext.should_receive(:current_repository).and_return 'ab.d' => 'a%{a}b'
41
+ subject.translate('xx', 'd', :scope=>['ab']).should == 'a%{a}b'
42
+ end
43
+
35
44
  it "can translate with gettext using symbols" do
36
- FastGettext.stub(:current_repository).and_return 'xy.z.v'=>'a'
45
+ FastGettext.should_receive(:current_repository).and_return 'xy.z.v'=>'a'
37
46
  subject.translate('xx',:v ,:scope=>['xy','z']).should == 'a'
38
47
  end
39
48
 
40
49
  it "can translate with gettext using a flat scope" do
41
- FastGettext.stub(:current_repository).and_return 'xy.z.x'=>'a'
50
+ FastGettext.should_receive(:current_repository).and_return 'xy.z.x'=>'a'
42
51
  subject.translate('xx',:x ,:scope=>'xy.z').should == 'a'
43
52
  end
44
53
 
45
54
  it "passes non-gettext keys to default backend" do
46
55
  subject.backend.should_receive(:translate).with('xx', 'c', {}).and_return 'd'
47
- FastGettext.stub(:current_repository).and_return 'a'=>'b'
56
+ FastGettext.should_receive(:current_repository).and_return 'a'=>'b'
48
57
  subject.translate('xx', 'c', {}).should == 'd'
49
58
  end
50
59
 
51
60
  if RUBY_VERSION > "1.9"
52
61
  it "produces UTF-8 when not using FastGettext to fix weird encoding bug" do
53
62
  subject.backend.should_receive(:translate).with('xx', 'c', {}).and_return 'ü'.force_encoding("US-ASCII")
54
- FastGettext.stub(:current_repository).and_return 'a'=>'b'
63
+ FastGettext.should_receive(:current_repository).and_return 'a'=>'b'
55
64
  result = subject.translate('xx', 'c', {})
56
65
  result.should == 'ü'
57
66
  end
58
67
 
59
68
  it "does not force_encoding on non-strings" do
60
69
  subject.backend.should_receive(:translate).with('xx', 'c', {}).and_return ['aa']
61
- FastGettext.stub(:current_repository).and_return 'a'=>'b'
70
+ FastGettext.should_receive(:current_repository).and_return 'a'=>'b'
62
71
  result = subject.translate('xx', 'c', {})
63
72
  result.should == ['aa']
64
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_i18n_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-02 00:00:00.000000000 Z
12
+ date: 2012-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fast_gettext
@@ -34,10 +34,27 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - .gitignore
37
+ - Appraisals
37
38
  - Gemfile
38
39
  - Gemfile.lock
39
40
  - Rakefile
40
41
  - Readme.md
42
+ - gemfiles/rails.2.3.gemfile
43
+ - gemfiles/rails.2.3.gemfile.lock
44
+ - gemfiles/rails.3.0.gemfile
45
+ - gemfiles/rails.3.0.gemfile.lock
46
+ - gemfiles/rails.3.1.gemfile
47
+ - gemfiles/rails.3.1.gemfile.lock
48
+ - gemfiles/rails.3.2.gemfile
49
+ - gemfiles/rails.3.2.gemfile.lock
50
+ - gemfiles/rails23.gemfile
51
+ - gemfiles/rails23.gemfile.lock
52
+ - gemfiles/rails30.gemfile
53
+ - gemfiles/rails30.gemfile.lock
54
+ - gemfiles/rails31.gemfile
55
+ - gemfiles/rails31.gemfile.lock
56
+ - gemfiles/rails32.gemfile
57
+ - gemfiles/rails32.gemfile.lock
41
58
  - gettext_i18n_rails.gemspec
42
59
  - init.rb
43
60
  - lib/gettext_i18n_rails.rb
@@ -85,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
102
  version: '0'
86
103
  segments:
87
104
  - 0
88
- hash: 4474784702351779304
105
+ hash: 1915795330397940793
89
106
  required_rubygems_version: !ruby/object:Gem::Requirement
90
107
  none: false
91
108
  requirements:
@@ -94,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
111
  version: '0'
95
112
  segments:
96
113
  - 0
97
- hash: 4474784702351779304
114
+ hash: 1915795330397940793
98
115
  requirements: []
99
116
  rubyforge_project:
100
117
  rubygems_version: 1.8.24