Sha256: 94767607a3ec746feb9a044e0fe9eedd34957a6dcf878bc4983b69944cab03ca

Contents?: true

Size: 731 Bytes

Versions: 13

Compression:

Stored size: 731 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 =~ /\.schema$/
      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

13 entries across 13 versions & 1 rubygems

Version Path
theme-check-1.15.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.14.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.13.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.12.1 lib/theme_check/checks/matching_translations.rb
theme-check-1.12.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.11.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.10.3 lib/theme_check/checks/matching_translations.rb
theme-check-1.10.2 lib/theme_check/checks/matching_translations.rb
theme-check-1.10.1 lib/theme_check/checks/matching_translations.rb
theme-check-1.10.0 lib/theme_check/checks/matching_translations.rb
theme-check-1.9.2 lib/theme_check/checks/matching_translations.rb
theme-check-1.9.1 lib/theme_check/checks/matching_translations.rb
theme-check-1.9.0 lib/theme_check/checks/matching_translations.rb