Module: I18n::Tasks::HtmlKeys

Included in:
BaseTask
Defined in:
lib/i18n/tasks/html_keys.rb

Constant Summary collapse

HTML_KEY_PATTERN =
/[.\-_]html\z/.freeze
MAYBE_PLURAL_HTML_KEY_PATTERN =
/[.\-_]html\.[^.]+\z/.freeze

Instance Method Summary collapse

Instance Method Details

#html_key?(full_key, locale) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/i18n/tasks/html_keys.rb', line 8

def html_key?(full_key, locale)
  !!(full_key =~ HTML_KEY_PATTERN ||
      (full_key =~ MAYBE_PLURAL_HTML_KEY_PATTERN &&
          depluralize_key(split_key(full_key, 2)[1], locale) =~ HTML_KEY_PATTERN))
end