Sha256: 87b9de19c3d130a6cc6a046fa4cfcc881368b0f5ef47e39084370edb82146a1b

Contents?: true

Size: 662 Bytes

Versions: 10

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

module ThemeCheck
  class MatchingTranslations < JsonCheck
    severity :suggestion
    category :translation

    def initialize
      @files = []
    end

    def on_file(file)
      return unless file.name.starts_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

10 entries across 10 versions & 1 rubygems

Version Path
theme-check-0.4.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.3.3 lib/theme_check/checks/matching_translations.rb
theme-check-0.3.2 lib/theme_check/checks/matching_translations.rb
theme-check-0.3.1 lib/theme_check/checks/matching_translations.rb
theme-check-0.3.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.2.2 lib/theme_check/checks/matching_translations.rb
theme-check-0.2.0 lib/theme_check/checks/matching_translations.rb
theme-check-0.1.2 lib/theme_check/checks/matching_translations.rb
theme-check-0.1.1 lib/theme_check/checks/matching_translations.rb
theme-check-0.1.0 lib/theme_check/checks/matching_translations.rb