Class: I18n::Hygiene::VariableChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n/hygiene/variable_checker.rb

Overview

Checks for mismatching interpolation variables. For example, if the value for an i18n key as defined in :en contains an interpolation variable, the value for that key as defined in any other locale must have a matching variable name.

Instance Method Summary collapse

Constructor Details

#initialize(key, i18n_wrapper, primary_locale, locales = []) ⇒ VariableChecker

Returns a new instance of VariableChecker.



7
8
9
10
11
12
# File 'lib/i18n/hygiene/variable_checker.rb', line 7

def initialize(key, i18n_wrapper, primary_locale, locales = [])
  @key = key
  @i18n_wrapper = i18n_wrapper
  @primary_locale = primary_locale
  @locales = locales
end

Instance Method Details

#mismatched_variablesObject



14
15
16
# File 'lib/i18n/hygiene/variable_checker.rb', line 14

def mismatched_variables
  @locales.each { |locale| yield locale, @key, missing_variables(locale) }
end