Module: ThemeCheck::ShopifyLiquid::SystemTranslations

Extended by:
SystemTranslations
Included in:
SystemTranslations
Defined in:
lib/theme_check/shopify_liquid/system_translations.rb

Instance Method Summary collapse

Instance Method Details

#include?(key) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/theme_check/shopify_liquid/system_translations.rb', line 17

def include?(key)
  translations.include?(key)
end

#translationsObject



7
8
9
# File 'lib/theme_check/shopify_liquid/system_translations.rb', line 7

def translations
  @translations ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_translation_keys.yml")).to_set
end

#translations_hashObject



11
12
13
14
15
# File 'lib/theme_check/shopify_liquid/system_translations.rb', line 11

def translations_hash
  @translations_hash ||= translations.reduce({}) do |acc, k|
    dig_set(acc, k.split('.'), "")
  end
end