def translate(locale, key, options = {})
raise InvalidLocale.new(locale) unless locale
return key.map { |k| translate(locale, k, options) } if key.is_a?(Array)
if options.empty?
entry = resolve(locale, key, lookup(locale, key), options)
raise(I18n::MissingTranslationData.new(locale, key, options)) if entry.nil?
else
count, scope, default = options.values_at(:count, :scope, :default)
values = options.reject { |name, value| RESERVED_KEYS.include?(name) }
entry = lookup(locale, key, scope, options)
entry = entry.nil? && default ? default(locale, key, default, options) : resolve(locale, key, entry, options)
raise(I18n::MissingTranslationData.new(locale, key, options)) if entry.nil?
entry = pluralize(locale, entry, count) if count
entry = interpolate(locale, entry, values) if values
end
entry
end