Skip to content

Commit

Permalink
Fix interpolations with repeated vars
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Oct 23, 2018
1 parent eee08a3 commit 9a4f7a1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.9.27

* Fixes `check-consistent-interpolations` when the same interpolation is used more than once.

## v0.9.26

* `eq-base` command now returns a non-zero exit code if there are any results.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
Add i18n-tasks to the Gemfile:

```ruby
gem 'i18n-tasks', '~> 0.9.26'
gem 'i18n-tasks', '~> 0.9.27'
```

Copy the default [configuration file](#configuration):
Expand Down
3 changes: 1 addition & 2 deletions lib/i18n/tasks/interpolations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ def inconsistent_interpolations(locales: nil, base_locale: nil) # rubocop:disabl
(locales - [base_locale]).each do |current_locale|
node = data[current_locale].first.children[key]
next unless node&.value&.is_a?(String)
vars = node.value.scan(VARIABLE_REGEX)
unless vars.size == base_vars.size && vars.all? { |v| base_vars.include?(v) }
if base_vars != Set.new(node.value.scan(VARIABLE_REGEX))
result.merge!(node.walk_to_root.reduce(nil) { |c, p| [p.derive(children: c)] })
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/tasks/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module I18n
module Tasks
VERSION = '0.9.26'
VERSION = '0.9.27'
end
end

0 comments on commit 9a4f7a1

Please sign in to comment.