Class: PlatformosCheck::TranslationFilesMatch
- Defined in:
- lib/platformos_check/checks/translation_files_match.rb
Constant Summary collapse
- PLURALIZATION_KEYS =
Set.new(%w[zero one two few many other])
Constants inherited from Check
Check::CATEGORIES, Check::SEVERITIES, Check::SEVERITY_VALUES
Instance Attribute Summary
Attributes inherited from Check
#ignored_patterns, #offenses, #options, #platformos_app
Instance Method Summary collapse
Methods inherited from YamlCheck
Methods included from ChecksTracking
Methods inherited from Check
#==, #add_offense, all, can_disable, #can_disable?, categories, #categories, category, #code_name, doc, #doc, docs_url, #ignore!, #ignored?, #severity, severity, #severity=, #severity_value, severity_value, single_file, #single_file?, #to_s, #whole_platformos_app?
Methods included from JsonHelpers
#format_json_parse_error, #pretty_json
Instance Method Details
#on_file(file) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/platformos_check/checks/translation_files_match.rb', line 11 def on_file(file) return unless file.translation? return if file.parse_error return add_offense_wrong_language_in_file(file) if file.language != file.language_from_path return check_if_file_exists_for_all_other_languages(file) if file.language == @platformos_app.default_language default_language_file = @platformos_app.grouped_files[PlatformosCheck::TranslationFile][file.name.sub(file.language, @platformos_app.default_language)] return add_offense_missing_file(file) if default_language_file.nil? add_offense_different_structure(file, default_language_file) unless same_structure?(default_language_file.content[@platformos_app.default_language], file.content[file.language]) end |