Sha256: 4e089161a0ce5446179f3296178b9dbc1123f1db5378ed5b887e94416d76fe3e

Contents?: true

Size: 550 Bytes

Versions: 11

Compression:

Stored size: 550 Bytes

Contents

require 'easy_translate'

module I18n::Tasks::GoogleTranslation
  def google_translate(strings, opts)
    return [] if strings.empty?
    opts = opts.dup
    if (key = translation_config[:api_key]).present?
      opts[:key] ||= key
    end
    if opts[:key].blank?
      $stderr.puts(Term::ANSIColor.red Term::ANSIColor.yellow 'You may need to provide Google API key as GOOGLE_TRANSLATE_API_KEY or in config/i18n-tasks.yml.
You can obtain the key at https://code.google.com/apis/console.')
    end
    EasyTranslate.translate strings, opts
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
i18n-tasks-0.2.13 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.12 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.11 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.10 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.9 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.8 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.7 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.6 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.5 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.4 lib/i18n/tasks/google_translation.rb
i18n-tasks-0.2.3 lib/i18n/tasks/google_translation.rb