gettext-setup 0.25 → 0.26

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: 7c3a0830df4687fec36b4c6ee1deb0e0e151b342
4
- data.tar.gz: 1f4b4ec5f9aee8c6aab1db042213214fb01f7560
3
+ metadata.gz: d76056589632a45d8d207a37b534aae61cca3aa2
4
+ data.tar.gz: 64c7222fcd4ef7a1f0ce2f78fe63c25f0a2e6ac5
5
5
  SHA512:
6
- metadata.gz: c456950e5c6c5bc5da76098dba4163fdd026c2fbc779e5f50d6ac9ce86d8832306603ad04de9848823bf8b2c1aa224671098c786692aa85d7ed12b13e11eb76e
7
- data.tar.gz: 3b53eb7cdafb53117de674dff9c464d1cf547ac529fef826b9af283bfbe1f943b07127fa1aca4e257ca7aaae762bf5b67aaff280c6736bf6e102930ae8befa86
6
+ metadata.gz: 664b2b64c91f93ea96ae19a3eb3add4e125d2b0dd9b5b3d9502d74845ae9f890839f66ae2fd549fac8224df0981abf8004e43a908a99ac567d9b6aa231e70729
7
+ data.tar.gz: 7f604a999607a42879c2975382184274f02529b2321b91a38b1cf89f52bf7bb88e55ad00108fcb7be34f1722a1315594ab2dcc1a56837a25a317c580325d1906
@@ -0,0 +1 @@
1
+ require 'metadata_pot/metadata_pot'
@@ -112,6 +112,10 @@ module GettextSetup
112
112
  available_locales = accept_header.split(',').map do |locale|
113
113
  pair = locale.strip.split(';q=')
114
114
  pair << '1.0' unless pair.size == 2
115
+ # Ignore everything but the language itself; that means that we treat
116
+ # 'de' and 'de-DE' identical, and would use the 'de' message catalog
117
+ # for both.
118
+ pair[0] = pair[0].split('-')[0]
115
119
  pair[0] = FastGettext.default_locale if pair[0] == '*'
116
120
  pair
117
121
  end.sort_by do |(_, qvalue)|
@@ -72,11 +72,10 @@ module GettextSetup
72
72
  def self.generate_new_po(language, locales_path = GettextSetup.locales_path,
73
73
  pot_file = nil, po_file = nil)
74
74
  GettextSetup.initialize(locales_path)
75
+ language ||= ENV['LANGUAGE']
75
76
  pot_file ||= GettextSetup::Pot.pot_file_path
76
77
  po_file ||= GettextSetup::Pot.po_file_path(language)
77
78
 
78
- language ||= ENV['LANGUAGE']
79
-
80
79
  # Let's do some pre-verification of the environment.
81
80
  if language.nil?
82
81
  puts "You need to specify the language to add. Either 'LANGUAGE=eo rake gettext:po' or 'rake gettext:po[LANGUAGE]'"
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'rspec/expectations'
2
3
  require_relative '../../spec_helper'
3
4
 
@@ -35,6 +36,10 @@ describe GettextSetup do
35
36
  expect(GettextSetup.negotiate_locale('en;q=1, de;q=2')).to eq('de')
36
37
  expect(GettextSetup.negotiate_locale('en;q=1, de;q=0')).to eq('en')
37
38
  end
39
+ it 'ignores country variant' do
40
+ expect(GettextSetup.negotiate_locale('en;q=1, de-DE;q=2')).to eq('de')
41
+ expect(GettextSetup.negotiate_locale('en;q=1, de-DE;q=0')).to eq('en')
42
+ end
38
43
  it 'chooses the first value when q values are equal' do
39
44
  expect(GettextSetup.negotiate_locale('de;q=1, en;q=1')).to eq('de')
40
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext-setup
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.25'
4
+ version: '0.26'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast_gettext
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rack-test
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rspec
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -164,20 +150,6 @@ dependencies:
164
150
  - - ">="
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: webmock
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
153
  - !ruby/object:Gem::Dependency
182
154
  name: rubocop
183
155
  requirement: !ruby/object:Gem::Requirement
@@ -201,6 +173,7 @@ extra_rdoc_files: []
201
173
  files:
202
174
  - LICENSE
203
175
  - README.md
176
+ - lib/generate_metadata_pot.rb
204
177
  - lib/gettext-setup.rb
205
178
  - lib/gettext-setup/gettext_setup.rb
206
179
  - lib/gettext-setup/metadata_pot.rb
@@ -222,9 +195,6 @@ files:
222
195
  - spec/fixtures/string_changes/non_string_changes.pot
223
196
  - spec/fixtures/string_changes/old.pot
224
197
  - spec/fixtures/string_changes/remove.pot
225
- - spec/fixtures/tmp_locales/config.yaml
226
- - spec/fixtures/tmp_locales/de/sinatra-i18n.po
227
- - spec/fixtures/tmp_locales/sinatra-i18n.pot
228
198
  - spec/lib/gettext-setup/gettext_setup_spec.rb
229
199
  - spec/lib/gettext-setup/metadata_pot_spec.rb
230
200
  - spec/lib/gettext-setup/pot_spec.rb
@@ -250,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
220
  version: '0'
251
221
  requirements: []
252
222
  rubyforge_project:
253
- rubygems_version: 2.2.2
223
+ rubygems_version: 2.5.2
254
224
  signing_key:
255
225
  specification_version: 4
256
226
  summary: A gem to ease internationalization with fast_gettext
@@ -269,9 +239,6 @@ test_files:
269
239
  - spec/fixtures/string_changes/non_string_changes.pot
270
240
  - spec/fixtures/string_changes/old.pot
271
241
  - spec/fixtures/string_changes/remove.pot
272
- - spec/fixtures/tmp_locales/config.yaml
273
- - spec/fixtures/tmp_locales/de/sinatra-i18n.po
274
- - spec/fixtures/tmp_locales/sinatra-i18n.pot
275
242
  - spec/lib/gettext-setup/gettext_setup_spec.rb
276
243
  - spec/lib/gettext-setup/metadata_pot_spec.rb
277
244
  - spec/lib/gettext-setup/pot_spec.rb
@@ -1,22 +0,0 @@
1
- ---
2
- # This is the project-specific configuration file for setting up
3
- # fast_gettext for your project.
4
- gettext:
5
- # This is used for the name of the .pot and .po files; they will be
6
- # called <project_name>.pot?
7
- project_name: 'sinatra-i18n'
8
- # This is used in comments in the .pot and .po files to indicate what
9
- # project the files belong to and should bea little more desctiptive than
10
- # <project_name>
11
- package_name: Sinatra i18n demo
12
- # The locale that the default messages in the .pot file are in
13
- default_locale: en
14
- # The email used for sending bug reports.
15
- bugs_address: docs@puppetlabs.com
16
- # The holder of the copyright.
17
- copyright_holder: Puppet Labs, LLC.
18
- # Patterns for +Dir.glob+ used to find all files that might contain
19
- # translatable content, relative to the project root directory
20
- source_files:
21
- - 'lib/**/*.rb'
22
- - 'spec/**/*.rb'
@@ -1,23 +0,0 @@
1
- # German translations for Sinatra i18n demo package.
2
- # Copyright (C) 2016 Puppet Labs, LLC.
3
- # This file is distributed under the same license as the Sinatra i18n demo package.
4
- # Automatically generated, 2016.
5
- #
6
- msgid ""
7
- msgstr ""
8
- "Project-Id-Version: Sinatra i18n demo \n"
9
- "Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
10
- "POT-Creation-Date: 2016-04-05 10:39-0700\n"
11
- "PO-Revision-Date: 2016-02-26 18:21-0800\n"
12
- "Last-Translator: Automatically generated\n"
13
- "Language-Team: none\n"
14
- "Language: de\n"
15
- "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=UTF-8\n"
17
- "Content-Transfer-Encoding: 8bit\n"
18
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
-
20
- #: ../app.rb:14
21
- msgid "Hello, world!"
22
- msgstr "Hallo, Welt!"
23
-
@@ -1,40 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2017 Puppet Labs, LLC.
3
- # This file is distributed under the same license as the Sinatra i18n demo package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
5
- #
6
- #, fuzzy
7
- msgid ""
8
- msgstr ""
9
- "Project-Id-Version: Sinatra i18n demo 0.21-4-geccdac4\n"
10
- "\n"
11
- "Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
12
- "POT-Creation-Date: 2017-04-11 20:08-0500\n"
13
- "PO-Revision-Date: 2017-04-11 20:08-0500\n"
14
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
- "Language-Team: LANGUAGE <LL@li.org>\n"
16
- "Language: \n"
17
- "MIME-Version: 1.0\n"
18
- "Content-Type: text/plain; charset=UTF-8\n"
19
- "Content-Transfer-Encoding: 8bit\n"
20
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
21
-
22
- #: ../../lib/gettext_setup_spec.rb:26 ../../lib/gettext_setup_spec.rb:89 ../../lib/gettext_setup_spec.rb:91
23
- msgid "Hello, world!"
24
- msgstr ""
25
-
26
- #: ../../lib/pot_spec.rb:52
27
- msgid "merged-po-file"
28
- msgstr ""
29
-
30
- #: ../../lib/pot_spec.rb:74
31
- msgid "no-pot-file"
32
- msgstr ""
33
-
34
- #: ../../lib/pot_spec.rb:85
35
- msgid "some-spec-only-string"
36
- msgstr ""
37
-
38
- #: ../../lib/pot_spec.rb:104
39
- msgid "unchanged-string"
40
- msgstr ""