lib/i18n/tasks/translators/yandex_translator.rb in i18n-tasks-0.9.33 vs lib/i18n/tasks/translators/yandex_translator.rb in i18n-tasks-0.9.34
- old
+ new
@@ -41,10 +41,11 @@
private
# Convert 'es-ES' to 'es'
def to_yandex_compatible_locale(locale)
return locale unless locale.include?('-')
+
locale.split('-', 2).first
end
def translator
@translator ||= Yandex::Translator.new(api_key)
@@ -52,9 +53,10 @@
def api_key
@api_key ||= begin
key = @i18n_tasks.translation_config[:yandex_api_key]
fail ::I18n::Tasks::CommandError, I18n.t('i18n_tasks.yandex_translate.errors.no_api_key') if key.blank?
+
key
end
end
end
end