gettext-setup 0.7 → 0.8
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 +4 -4
- data/lib/gettext-setup/gettext_setup.rb +5 -6
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ac437b963a9af37802ffa40fd34a7ed9d9945a8
|
4
|
+
data.tar.gz: 0f5aefcd22d784e9f2992638e67b3f0a7429d83a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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.
|
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-
|
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:
|