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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0229b3a4c2b8749a457c6b71e412a80802a6aa3
4
- data.tar.gz: e43c66b6e67ef86dd28fcb7d7c9875c4578c9b84
3
+ metadata.gz: e38c549e1d0303125dde7b029aa4ed4f5daa13ba
4
+ data.tar.gz: 55337517009dfeba3b60027c9c2fe1d9dd3aca21
5
5
  SHA512:
6
- metadata.gz: d370ab448ca1126486d67e810b9dab6f20ea07b5145c297a3fdbc15bf03fc6c3118434d93803b9b7ba9147b57b36f30b9582ab7af27d6d31172fe79d84157737
7
- data.tar.gz: 0f1a783ca1d8ca7024d26f9506fc814ac6eff22ddb1141f4730567e73730c287e192a216ad5f4971d399d0df664ade82a8cf72301a1486e1cffff15b4a254bf9
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.5'
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| HtmlKeys.html_key? k_v[0] }.map { |is_html, list_slice|
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)
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
  module I18n::Tasks
3
3
  module HtmlKeys
4
- extend self
5
- HTML_KEY_PATTERN = /[.\-_]html\z/.freeze
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
@@ -19,7 +19,7 @@ module I18n::Tasks::Scanners
19
19
  literal
20
20
  end
21
21
 
22
- VALID_KEY_CHARS = /(?:[[:word:]]|[-.?!;À-ž])/
22
+ VALID_KEY_CHARS = /(?:[[:word:]]|[-.?!:;À-ž])/
23
23
  VALID_KEY_RE = /^#{VALID_KEY_CHARS}+$/
24
24
 
25
25
  def valid_key?(key)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module I18n
3
3
  module Tasks
4
- VERSION = '0.9.5'
4
+ VERSION = '0.9.6'
5
5
  end
6
6
  end
@@ -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
- # <%#= I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
114
- # only: %w(*.html.haml *.html.slim),
115
- # patterns: [['= title\b', '.page_title']] %>
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
- # <%#= I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
120
- # patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
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.5
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-03-06 00:00:00.000000000 Z
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.5.1
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