Class: I18n::Hygiene::Checks::UnexpectedReturnSymbol
- Defined in:
- lib/i18n/hygiene/checks/unexpected_return_symbol.rb
Overview
Looks for unexpected return symbols (U+23CE) in translations.
This check is fairly specific to PhraseApp, where U+23CE has special meaning.
Constant Summary collapse
- RETURN_SYMBOL_REGEX =
/\u23ce/
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from I18n::Hygiene::Checks::Base
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/i18n/hygiene/checks/unexpected_return_symbol.rb', line 16 def run wrapper = I18n::Hygiene::Wrapper.new(locales: all_locales, exclude_scopes: config.exclude_scopes) keys_with_return_symbols = I18n::Hygiene::KeysWithMatchedValue.new(RETURN_SYMBOL_REGEX, wrapper) keys_with_return_symbols.each do |locale, key| = ErrorMessageBuilder.new .title("Unexpected return symbol (U+23CE)") .locale(locale) .key(key) .translation(wrapper.value(locale, key)) .create yield Result.new(:failure, message: ) end end |