gettext-setup 0.11 → 0.12

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
2
  SHA1:
3
- metadata.gz: 7c5ec999e9e07642d3bc10efa9a6e0acfeef995d
4
- data.tar.gz: 11b5919a0c12d5911c73bb79de5d78d43a4e49db
3
+ metadata.gz: d1ff3e5f7747f9bba978668895c4e001d989fff2
4
+ data.tar.gz: 9abe9970c2aa1b735657b39a90060be0bc546c31
5
5
  SHA512:
6
- metadata.gz: 68067a707c35788e682e74abe89afc11cdc580b6dddec91e34663afe5b1e9bcc384e7472e6781aae9bbbc6844037aa615d7c3e85f53879f2087e2548dff7a63d
7
- data.tar.gz: d8e73f312ab6690ddc336ef336469d9a56e7e7103d2885f18c330f0993bef9d69683b720ff50ba5491f6d5c01855f4d1de622e9f18d59e56d96c6071ed49d89b
6
+ metadata.gz: 97bb39e683b537bb2b2e78f5edf6daf83bcad583950db1107802525dcc346950a93a8d86ffb85b2e124d1bb3cfe0caa7742c71ef7f1e118670edc5970d3ec8d5
7
+ data.tar.gz: 07129328df93aaadbd749d06cc8355e68cb06cf489d86077813298c14abed6b03c56ba3e6474931b6eca6bf5cdbedeaa3c7efdf808c160baf623edf2a11d7bb7
@@ -42,19 +42,29 @@ module GettextSetup
42
42
  end
43
43
 
44
44
  def self.config
45
- @@config
45
+ @@config ||= {}
46
46
  end
47
47
 
48
48
  def self.default_locale
49
49
  config['default_locale'] || "en"
50
50
  end
51
51
 
52
+ def self.set_default_locale(new_locale)
53
+ FastGettext.default_locale = new_locale
54
+ Locale.set_default(new_locale)
55
+ config['default_locale'] = new_locale
56
+ end
57
+
52
58
  # Returns the locale for the current machine. This is most useful for shell
53
59
  # applications that need an ACCEPT-LANGUAGE header set.
54
60
  def self.candidate_locales
55
61
  Locale.candidates(type: :cldr).join(',')
56
62
  end
57
63
 
64
+ def self.clear
65
+ Locale.clear
66
+ end
67
+
58
68
  def self.locales
59
69
  explicit = Dir.glob(File::absolute_path('*/*.po', locales_path)).map do |x|
60
70
  File::basename(File::dirname(x))
@@ -32,4 +32,23 @@ describe GettextSetup do
32
32
  expect(GettextSetup.negotiate_locale('en;q=1, de;q=0')).to eq('en')
33
33
  end
34
34
  end
35
+ context 'set_default_locale' do
36
+ before :each do
37
+ GettextSetup.set_default_locale('en')
38
+ end
39
+ it 'allows setting the default locale' do
40
+ expect(GettextSetup.default_locale).to eq('en')
41
+ GettextSetup.set_default_locale('de')
42
+ expect(GettextSetup.default_locale).to eq('de')
43
+ end
44
+ end
45
+ context 'clear' do
46
+ it "can clear the locale" do
47
+ expect(GettextSetup.default_locale).to eq('en')
48
+ expect(GettextSetup.candidate_locales).to eq('en_US,en')
49
+ GettextSetup.clear
50
+ ENV['LANG'] = 'de_DE'
51
+ expect(GettextSetup.candidate_locales).to eq('de_DE,de,en')
52
+ end
53
+ end
35
54
  end
metadata CHANGED
@@ -1,181 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext-setup
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-06 00:00:00.000000000 Z
11
+ date: 2017-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: gettext
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - '>='
18
17
  - !ruby/object:Gem::Version
19
18
  version: 3.0.2
20
- type: :runtime
19
+ name: gettext
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.2
27
27
  - !ruby/object:Gem::Dependency
28
- name: fast_gettext
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
30
+ - - ~>
32
31
  - !ruby/object:Gem::Version
33
32
  version: 1.1.0
34
- type: :runtime
33
+ name: fast_gettext
35
34
  prerelease: false
35
+ type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: locale
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - ">="
44
+ - - '>='
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0'
48
- type: :runtime
47
+ name: locale
49
48
  prerelease: false
49
+ type: :runtime
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - "~>"
58
+ - - ~>
60
59
  - !ruby/object:Gem::Version
61
60
  version: '1.3'
62
- type: :development
61
+ name: bundler
63
62
  prerelease: false
63
+ type: :development
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - ">="
72
+ - - '>='
74
73
  - !ruby/object:Gem::Version
75
74
  version: '0'
76
- type: :development
75
+ name: rake
77
76
  prerelease: false
77
+ type: :development
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rack-test
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
- - - ">="
86
+ - - '>='
88
87
  - !ruby/object:Gem::Version
89
88
  version: '0'
90
- type: :development
89
+ name: rack-test
91
90
  prerelease: false
91
+ type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rspec
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
- - - "~>"
100
+ - - ~>
102
101
  - !ruby/object:Gem::Version
103
102
  version: '3.1'
104
- type: :development
103
+ name: rspec
105
104
  prerelease: false
105
+ type: :development
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.1'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec-core
113
112
  requirement: !ruby/object:Gem::Requirement
114
113
  requirements:
115
- - - "~>"
114
+ - - ~>
116
115
  - !ruby/object:Gem::Version
117
116
  version: '3.1'
118
- type: :development
117
+ name: rspec-core
119
118
  prerelease: false
119
+ type: :development
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '3.1'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec-expectations
127
126
  requirement: !ruby/object:Gem::Requirement
128
127
  requirements:
129
- - - "~>"
128
+ - - ~>
130
129
  - !ruby/object:Gem::Version
131
130
  version: '3.1'
132
- type: :development
131
+ name: rspec-expectations
133
132
  prerelease: false
133
+ type: :development
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.1'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rspec-mocks
141
140
  requirement: !ruby/object:Gem::Requirement
142
141
  requirements:
143
- - - "~>"
142
+ - - ~>
144
143
  - !ruby/object:Gem::Version
145
144
  version: '3.1'
146
- type: :development
145
+ name: rspec-mocks
147
146
  prerelease: false
147
+ type: :development
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: '3.1'
153
153
  - !ruby/object:Gem::Dependency
154
- name: simplecov
155
154
  requirement: !ruby/object:Gem::Requirement
156
155
  requirements:
157
- - - ">="
156
+ - - '>='
158
157
  - !ruby/object:Gem::Version
159
158
  version: '0'
160
- type: :development
159
+ name: simplecov
161
160
  prerelease: false
161
+ type: :development
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: webmock
169
168
  requirement: !ruby/object:Gem::Requirement
170
169
  requirements:
171
- - - ">="
170
+ - - '>='
172
171
  - !ruby/object:Gem::Version
173
172
  version: '0'
174
- type: :development
173
+ name: webmock
175
174
  prerelease: false
175
+ type: :development
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - '>='
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  description: A gem to ease i18n
@@ -200,29 +200,29 @@ homepage: https://github.com/puppetlabs/gettext-setup-gem
200
200
  licenses:
201
201
  - Apache-2.0
202
202
  metadata: {}
203
- post_install_message:
203
+ post_install_message:
204
204
  rdoc_options: []
205
205
  require_paths:
206
206
  - lib
207
207
  required_ruby_version: !ruby/object:Gem::Requirement
208
208
  requirements:
209
- - - ">="
209
+ - - '>='
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
- - - ">="
214
+ - - '>='
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubyforge_project:
219
- rubygems_version: 2.2.2
220
- signing_key:
218
+ rubyforge_project:
219
+ rubygems_version: 2.4.5
220
+ signing_key:
221
221
  specification_version: 4
222
222
  summary: A gem to ease internationalization with fast_gettext
223
223
  test_files:
224
+ - spec/spec_helper.rb
224
225
  - spec/fixtures/locales/config.yaml
225
- - spec/fixtures/locales/de/sinatra-i18n.po
226
226
  - spec/fixtures/locales/sinatra-i18n.pot
227
+ - spec/fixtures/locales/de/sinatra-i18n.po
227
228
  - spec/lib/gettext_setup_spec.rb
228
- - spec/spec_helper.rb