gettext-setup 0.7 → 0.8

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: 65e84a0004d419316442af1c7f23fd7a6451ffec
4
- data.tar.gz: 962b4176c69de9c104257658e9aca03de80e97a1
3
+ metadata.gz: 5ac437b963a9af37802ffa40fd34a7ed9d9945a8
4
+ data.tar.gz: 0f5aefcd22d784e9f2992638e67b3f0a7429d83a
5
5
  SHA512:
6
- metadata.gz: 433fda65cffba5aa926e086a9ae42b124dd75d5ab57e491f70695a2f8e23fa59d885e345df02fb8d3563bf1880a026df61c1cad2ac68c53c156cbba6a6c4e15f
7
- data.tar.gz: 79f6d289cae03bcf78fd065f9fb1057194dc14aff27fbf264c3a2feeae2068fb50972c54a54c90dfc97a472c77d289fe91d6c5c228eaa9e9c0db6b8278c5b5c0
6
+ metadata.gz: 2d32e874c6019c166746988fc98cca9d0c2c32183e1635734eb4ff663751d766e37fbc33f7f60dbcf19e96de2ae0adb02f52943243292804a6e08f77bd4bee39
7
+ data.tar.gz: 0b48f19a3f7d98c2eeb6a0c1d476bbd5e3deec846d85a1816cec8ea44bbf34165891b35a9700a2e8b52b766fa739d6760b2285a6c673737cbea1fe46422e5e44
@@ -9,7 +9,10 @@ module GettextSetup
9
9
  # - config.yaml
10
10
  # - a .pot file for the project
11
11
  # - i18n directories for languages, each with a .po file
12
- def self.initialize(locales_path)
12
+ # - if using .mo files, an LC_MESSAGES dir in each language dir, with the .mo file in it
13
+ # valid `options` fields:
14
+ # :file_format - one of the supported backends for fast_gettext (e.g. :po, :mo, :yaml, etc.)
15
+ def self.initialize(locales_path, options = {})
13
16
  config_path = File.absolute_path('config.yaml', locales_path)
14
17
  @@config = YAML.load_file(config_path)['gettext']
15
18
  @@locales_path = locales_path
@@ -20,13 +23,9 @@ module GettextSetup
20
23
  # Define our text domain, and set the path into our root. I would prefer to
21
24
  # have something smarter, but we really want this up earlier even than our
22
25
  # config loading happens so that errors there can be translated.
23
- #
24
- # We use the PO files directly, since it works about as efficiently with
25
- # fast_gettext, and avoids all the extra overhead of compilation down to
26
- # machine format, etc.
27
26
  FastGettext.add_text_domain(config['project_name'],
28
27
  :path => locales_path,
29
- :type => :po,
28
+ :type => options[:file_format] || :po,
30
29
  :ignore_fuzzy => false)
31
30
  FastGettext.default_text_domain = config['project_name']
32
31
 
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.7'
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-13 00:00:00.000000000 Z
11
+ date: 2016-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -212,4 +212,3 @@ test_files:
212
212
  - spec/fixtures/locales/sinatra-i18n.pot
213
213
  - spec/fixtures/locales/de/sinatra-i18n.po
214
214
  - spec/lib/gettext_setup_spec.rb
215
- has_rdoc: