i18n-tasks 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/i18n/tasks/google_translation.rb +1 -1
- data/lib/i18n/tasks/html_keys.rb +6 -4
- data/lib/i18n/tasks/scanners/pattern_scanner.rb +1 -1
- data/lib/i18n/tasks/scanners/ruby_key_literals.rb +1 -1
- data/lib/i18n/tasks/version.rb +1 -1
- data/templates/config/i18n-tasks.yml +6 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38c549e1d0303125dde7b029aa4ed4f5daa13ba
|
4
|
+
data.tar.gz: 55337517009dfeba3b60027c9c2fe1d9dd3aca21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9bada34e186461d3c9941f24fba746e06628681d68f925e34a874769c8046cec65d7ed06717fe0f16efefa85543db799c8a8f0997eff2f28ec2f8b3f7b81d44
|
7
|
+
data.tar.gz: e83e89d336812b51fc0ea49fe1364f086d1efa56008e26810955205032d7839d590d905985ef4891bd477e111f1820807f707adfc73d1f33e5245c427ec5f3c7
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
|
|
24
24
|
Add i18n-tasks to the Gemfile:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
gem 'i18n-tasks', '~> 0.9.
|
27
|
+
gem 'i18n-tasks', '~> 0.9.6'
|
28
28
|
```
|
29
29
|
|
30
30
|
Copy the default [configuration file](#configuration):
|
@@ -26,7 +26,7 @@ module I18n::Tasks
|
|
26
26
|
# copy reference keys as is, instead of translating
|
27
27
|
reference_key_vals = list.select { |_k, v| v.is_a? Symbol } || []
|
28
28
|
list -= reference_key_vals
|
29
|
-
result = list.group_by { |k_v|
|
29
|
+
result = list.group_by { |k_v| html_key? k_v[0], opts[:from] }.map { |is_html, list_slice|
|
30
30
|
fetch_google_translations list_slice, opts.merge(is_html ? {html: true} : {format: 'text'})
|
31
31
|
}.reduce(:+) || []
|
32
32
|
result.concat(reference_key_vals)
|
data/lib/i18n/tasks/html_keys.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module I18n::Tasks
|
3
3
|
module HtmlKeys
|
4
|
-
|
5
|
-
|
4
|
+
HTML_KEY_PATTERN = /[.\-_]html\z/
|
5
|
+
MAYBE_PLURAL_HTML_KEY_PATTERN = /[.\-_]html\.[^.]+\z/
|
6
6
|
|
7
|
-
def html_key?(full_key)
|
8
|
-
!!(full_key =~ HTML_KEY_PATTERN
|
7
|
+
def html_key?(full_key, locale)
|
8
|
+
!!(full_key =~ HTML_KEY_PATTERN ||
|
9
|
+
full_key =~ MAYBE_PLURAL_HTML_KEY_PATTERN &&
|
10
|
+
depluralize_key(split_key(full_key, 2)[1], locale) =~ HTML_KEY_PATTERN)
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
@@ -14,7 +14,7 @@ module I18n::Tasks::Scanners
|
|
14
14
|
def initialize(**args)
|
15
15
|
super
|
16
16
|
@pattern = config[:pattern].present? ? Regexp.new(config[:pattern]) : default_pattern
|
17
|
-
@ignore_lines_res = (config[:ignore_lines] || []).inject({}) { |h, (ext, re)| h.update(ext => Regexp.new(re)) }
|
17
|
+
@ignore_lines_res = (config[:ignore_lines] || []).inject({}) { |h, (ext, re)| h.update(ext.to_s => Regexp.new(re)) }
|
18
18
|
end
|
19
19
|
|
20
20
|
protected
|
data/lib/i18n/tasks/version.rb
CHANGED
@@ -65,6 +65,7 @@ search:
|
|
65
65
|
exclude:
|
66
66
|
- app/assets/images
|
67
67
|
- app/assets/fonts
|
68
|
+
- app/assets/videos
|
68
69
|
|
69
70
|
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
70
71
|
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
@@ -110,11 +111,11 @@ search:
|
|
110
111
|
## e.g. in case of a relative key defined in a helper method.
|
111
112
|
## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
|
112
113
|
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
114
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
115
|
+
# only: %w(*.html.haml *.html.slim),
|
116
|
+
# patterns: [['= title\b', '.page_title']] %>
|
116
117
|
#
|
117
118
|
# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
|
118
119
|
#
|
119
|
-
#
|
120
|
-
#
|
120
|
+
# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
121
|
+
# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -325,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
325
325
|
version: '0'
|
326
326
|
requirements: []
|
327
327
|
rubyforge_project:
|
328
|
-
rubygems_version: 2.
|
328
|
+
rubygems_version: 2.6.8
|
329
329
|
signing_key:
|
330
330
|
specification_version: 4
|
331
331
|
summary: Manage localization and translation with the awesome power of static analysis
|