Class: I18n::Hygiene::LocaleTranslations

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

Overview

Wrap all translations for a single locale, with knowledge of the keys that aren’t in our control. Can return the i18n keys that are in our control, and therefore are interesting for a variety of reasons.

Instance Method Summary collapse

Constructor Details

#initialize(translations:, exclude_keys:, exclude_scopes:) ⇒ LocaleTranslations

These are i18n keys provided by Rails. We cannot exclude them at the :helpers scope level because we do have some TC i18n keys scoped within :helpers.



10
11
12
13
14
# File 'lib/i18n/hygiene/locale_translations.rb', line 10

def initialize(translations:, exclude_keys:, exclude_scopes:)
  @translations = translations
  @exclude_keys = exclude_keys || []
  @exclude_scopes = exclude_scopes || []
end

Instance Method Details

#keys_to_checkObject



16
17
18
19
20
# File 'lib/i18n/hygiene/locale_translations.rb', line 16

def keys_to_check
  fully_qualified_keys(translations_to_check).reject { |key|
    exclude_keys.include?(key)
  }.sort
end