Sha256: 002ceec3aff3b1d36c86d69ad2d57a2b44148d0ddc5a2b1cd10db8d163f2773e

Contents?: true

Size: 643 Bytes

Versions: 12

Compression:

Stored size: 643 Bytes

Contents

module Locomotive::Wagon

  class PullTranslationsCommand < PullBaseCommand

    def _pull
      translations = api_client.translations.all.inject({}) do |hash, translation|
        translation.values.delete_if { |locale, _| !locales.include?(locale) }
        hash[translation.key] = translation.values
        hash
      end

      unless translations.empty?
        write_translations(translations)
      end
    end

    private

    def write_translations(translations)
      write_to_file(translations_filepath, dump(translations))
    end

    def translations_filepath
      File.join('config', 'translations.yml')
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
locomotivecms_wagon-3.2.0.alpha2 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.2.0.alpha1 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.1.1 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.1.0 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.1.0.beta1 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.5 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.4 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.3 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.2 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.0 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.0.rc0 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb
locomotivecms_wagon-3.0.0.beta2 lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb