class I18n::Hygiene::Checks::ScriptTag
Looks for unexpected script tags in translations.
Constants
- SCRIPT_TAG_REGEX
Public Instance Methods
run() { |result(:failure, message: message)| ... }
click to toggle source
# File lib/i18n/hygiene/checks/script_tag.rb, line 15 def run wrapper = I18n::Hygiene::Wrapper.new(locales: all_locales, exclude_scopes: config.exclude_scopes) keys_with_script_tags = I18n::Hygiene::KeysWithMatchedValue.new(SCRIPT_TAG_REGEX, wrapper) keys_with_script_tags.each do |locale, key| message = ErrorMessageBuilder.new .title("Unexpected script tag") .locale(locale) .key(key) .translation(wrapper.value(locale, key)) .create yield Result.new(:failure, message: message) end end