i18n-tasks 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/README.md +10 -2
- data/i18n-tasks.gemspec +1 -0
- data/lib/i18n/tasks.rb +7 -3
- data/lib/i18n/tasks/data_traversal.rb +1 -1
- data/lib/i18n/tasks/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1bc1cb806707bc4c7658d1c26a943c92dbd654c
|
4
|
+
data.tar.gz: b63519bafa3e4f0f149a553c10af48f6e16e5b0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8b9bd686f9bfce0e95e335f28a14afa966acc6b2c7f3a916c8f5fe5ca6a9b7b33cac512684d768f1646f2e220f3bb4e46e1e5eaab3f178f07f3c0858e7c068
|
7
|
+
data.tar.gz: a5384b5edd7c0fcf17d0bd4264e81e2db0f071ddf525933403370fd1fcf6bbc5c89788b4b8bb924f1e7645561ed253618556c1083a49de69ac6240b3dd7b751a
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -73,7 +73,7 @@ For more examples see [the tests](/spec/i18n_tasks_spec.rb).
|
|
73
73
|
Simply add to Gemfile:
|
74
74
|
|
75
75
|
```ruby
|
76
|
-
gem 'i18n-tasks', '~> 0.2.
|
76
|
+
gem 'i18n-tasks', '~> 0.2.6'
|
77
77
|
```
|
78
78
|
|
79
79
|
If you do not use Rails, you will also need to require the tasks in your Rakefile:
|
@@ -85,7 +85,15 @@ load 'tasks/i18n-tasks.rake'
|
|
85
85
|
|
86
86
|
## Configuration
|
87
87
|
|
88
|
-
Configuration is read from `config/i18n-tasks.yml
|
88
|
+
Configuration is read from `config/i18n-tasks.yml` (processed with ERB then Yaml).
|
89
|
+
|
90
|
+
By default, `i18n-tasks` will work with `I18n.default_locale` and `I18n.available_locales`, but you can override this:
|
91
|
+
|
92
|
+
```yaml
|
93
|
+
# config/i18n-tasks.yml
|
94
|
+
base_locale: en
|
95
|
+
locales: [es, fr]
|
96
|
+
```
|
89
97
|
|
90
98
|
### Storage
|
91
99
|
|
data/i18n-tasks.gemspec
CHANGED
data/lib/i18n/tasks.rb
CHANGED
@@ -4,16 +4,20 @@ require 'active_support/core_ext/string'
|
|
4
4
|
require 'active_support/core_ext/module/delegation'
|
5
5
|
require 'active_support/core_ext/object/try'
|
6
6
|
require 'term/ansicolor'
|
7
|
+
require 'erubis'
|
7
8
|
require 'i18n/tasks/railtie' if defined?(Rails)
|
8
9
|
|
9
10
|
module I18n
|
10
11
|
module Tasks
|
11
|
-
|
12
|
+
CONFIG_FILES = %w(
|
13
|
+
config/i18n-tasks.yml config/i18n-tasks.yml.erb
|
14
|
+
i18n-tasks.yml i18n-tasks.yml.erb
|
15
|
+
)
|
12
16
|
class << self
|
13
17
|
def config
|
14
18
|
@config ||= begin
|
15
|
-
file = File.read(
|
16
|
-
file = YAML.load(file) if file.present?
|
19
|
+
file = File.read(CONFIG_FILES.detect { |f| File.exists?(f) })
|
20
|
+
file = YAML.load(Erubis::Eruby.new(file).result) if file.present?
|
17
21
|
HashWithIndifferentAccess.new.merge(file.presence || {})
|
18
22
|
end
|
19
23
|
end
|
@@ -4,7 +4,7 @@ module I18n::Tasks::DataTraversal
|
|
4
4
|
def t(hash = data[base_locale], key)
|
5
5
|
if hash.is_a?(String)
|
6
6
|
# has is a locale
|
7
|
-
raise ArgumentError.new("invalid locale: #{hash}") if hash =~
|
7
|
+
raise ArgumentError.new("invalid locale: #{hash}") if hash =~ /[^A-z-]/
|
8
8
|
hash = data[hash]
|
9
9
|
end
|
10
10
|
key.split('.').inject(hash) { |r, seg| r[seg] if r }
|
data/lib/i18n/tasks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebm
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: erubis
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: activesupport
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|