lib/i18n/migrations/google_translate_dictionary.rb
# key is provided so we can figure out if this is text or html
# returns [translated term, errors || []]
key is provided so we can figure out if this is text or html
returns [translated term, errors || []]
key is provided so we can figure out if this is text or html returns [ translated term errors || [] ]
def lookup(term, key: nil)
        return [term, ''] if @from_locale == @to_locale
        response = google_translate(key: @key,
                                    source: @from_locale,
                                    target: @to_locale,
                                    format: format(key),
                                    q: term)
        translated_term = JSON.parse(response.body)['data']['translations'].first['translatedText']
        fix(term, translated_term, key: key)
      end
def lookup ( term , key : nil ) return [ term , '' ] if @from_locale == @to_locale response = google_translate ( key : @key , source : @from_locale , target : @to_locale , format : format ( key ) , q : term ) translated_term = JSON . parse ( response . body ) [ 'data' ] [ 'translations' ] . first [ 'translatedText' ] fix ( term , translated_term , key : key ) end
key is provided so we can figure out if this is text or html
returns [translated term, errors || []]
key is provided so we can figure out if this is text or html returns [ translated term errors || [] ]
term
<not_specific>
key
<not_specific>