Sha256: 5ea0edecede225a7804d1034d2f2325e91ab04fcd8e599aa86a498849e4afa7f

Contents?: true

Size: 688 Bytes

Versions: 23

Compression:

Stored size: 688 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, template: file)
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
theme-check-1.6.1 lib/theme_check/checks/matching_translations.rb
theme-check-1.6.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.5.2 lib/theme_check/checks/matching_translations.rb
theme-check-1.5.1 lib/theme_check/checks/matching_translations.rb
theme-check-1.5.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.4.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.3.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.2.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.1.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.0.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.10.2 lib/theme_check/checks/matching_translations.rb
theme-check-0.10.1 lib/theme_check/checks/matching_translations.rb
theme-check-0.10.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.9.1 lib/theme_check/checks/matching_translations.rb
theme-check-0.9.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.8.3 lib/theme_check/checks/matching_translations.rb
theme-check-0.8.2 lib/theme_check/checks/matching_translations.rb
theme-check-0.8.1 lib/theme_check/checks/matching_translations.rb
theme-check-0.8.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.7.3 lib/theme_check/checks/matching_translations.rb