Sha256: 50c653dbef2a94d0d64bb374fa8037c4094872b4f1f32985f8726ca8fb4c631b

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

require 'json'

module Alephant
  module Renderer
    module I18n
      class Json < LocaleComponentYaml
        private

        def load_translations
          return unless i18n_lib.load_path.empty?
          translations_files.map do |file|
            store_translation(file)
          end
        end

        def store_translation(file)
          translations = JSON.parse(File.read(file))
          translations.each do |locale, content|
            i18n_lib.backend.store_translations(locale, content)
          end
        end

        def translation_filename
          File.join(translations_path, '*.json')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alephant-renderer-3.2.0 lib/alephant/renderer/i18n/json.rb
alephant-renderer-3.1.0 lib/alephant/renderer/i18n/json.rb