Sha256: 7766c97daecf2361926cb754a94a6e03d17856c38202cb2df211f1ddf80c3fa4
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module PlatformosCheck class TranslationFile < YamlFile DIR_PREFIX = %r{\A/?((marketplace_builder|app)/(translations)/|(app/)?modules/((\w|-)*)/(private|public)/(translations)/)} TRANSLATION_FILTERS = Set.new(%w[t t_escape translate translate_escape]).freeze attr_reader :language def load! before_load super after_load end def before_load @storage.platformos_app.instance_variable_set(:@translations_hash, nil) unless @loaded end def after_load @language = @content&.keys&.first return if module_name.nil? @content[@language].transform_keys! { |key| key.start_with?(module_prefix) ? key : "#{module_prefix}#{key}" } end def language_from_path @language_from_path ||= name.sub(module_prefix, '').split(File::SEPARATOR).first end def update_contents(new_content = {}) before_load super(new_content) @loaded = true after_load end def dir_prefix DIR_PREFIX end def translation? true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
platformos-check-0.4.14 | lib/platformos_check/translation_file.rb |