Class: Locomotive::Wagon::PullTranslationsCommand

Inherits:
PullBaseCommand show all
Defined in:
lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb

Direct Known Subclasses

SyncTranslationsCommand

Constant Summary

Constants included from AssetsConcern

AssetsConcern::REGEX

Instance Attribute Summary

Attributes inherited from PullBaseCommand

#api_client, #current_site, #env, #path

Instance Method Summary collapse

Methods inherited from PullBaseCommand

#_pull_with_timezone, #clean_attributes, #default_locale, #dump, #instrument, #instrument_base_name, #is_default_locale?, #locales, #pull, pull, #reset_file, #resource_name, #write_to_file

Methods included from AssetsConcern

#replace_asset_urls, #replace_asset_urls_in_hash

Instance Method Details

#_pullObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/locomotive/wagon/commands/pull_sub_commands/pull_translations_command.rb', line 5

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