Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22041 when checking for "inconsistent interpolations" also check for "unrestored interpolations" #4

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/i18n/tasks/interpolations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,27 @@ def inconsistent_interpolations(locales: nil, base_locale: nil) # rubocop:disabl
end
end

result.merge!(unrestored_interpolations(locales: locales))
result.each { |root| root.data[:type] = :inconsistent_interpolations }
result
end

def unrestored_interpolations(locales: nil)
locales ||= self.locales
result = empty_forest

locales.each do |locale|
data[locale].key_values.each do |key, value|
next unless value.is_a?(String)
next unless value.include?('!!!!!')

node = Data::Tree::Node.new(key: key, value: value)
result.set(key, node)
end
end
result
end

def get_normalized_variables_set(string)
Set.new(string.scan(I18n::Tasks::Interpolations.variable_regex).map { |variable| normalize(variable) })
end
Expand Down