Sha256: 0800777373f6b0c95b8f6932f6419cd77cb7dd5384d47d6c4f8a9244aab90f1e

Contents?: true

Size: 690 Bytes

Versions: 5

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

module ThemeCheck
  class MatchingTranslations < JsonCheck
    severity :suggestion
    category :translation
    doc docs_url(__FILE__)

    def initialize
      @files = []
    end

    def on_file(file)
      return unless file.name.start_with?("locales/")
      return unless file.content.is_a?(Hash)
      return if file.name == @theme.default_locale_json&.name

      @files << file
    end

    def on_end
      return unless @theme.default_locale_json&.content

      @files.each do |file|
        diff = LocaleDiff.new(@theme.default_locale_json.content, file.content)
        diff.add_as_offenses(self, theme_file: file)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
theme-check-1.8.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.7.2 lib/theme_check/checks/matching_translations.rb
theme-check-1.7.1 lib/theme_check/checks/matching_translations.rb
theme-check-1.7.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.6.2 lib/theme_check/checks/matching_translations.rb