dolanmiu / grunt-google-translate

A build task to translate JSON files to other languages using Google's Translation API. Pairs very well with angular-translate.
MIT License
9 stars 2 forks source link

Cannot read property '0' of undefined #1

Closed crebuh closed 8 years ago

crebuh commented 8 years ago

Hi,

i found your plugin today and was glad, that there is a possibility to leverage the google translate api with a grunt task.

Unfortunately the task didn't work for me, even if I try it with a simple json file like this:

{
    "short": "Share"
}

But when I run the task I always receive the following error.

Running "google_translate:default_options" (google_translate) task Fatal error: Cannot read property '0' of undefined

thx in advance

basghar commented 8 years ago

This is because error handling for googleTranslate.translate is not done. I can send a pull request if author is active

In other words, if google returns an error, the task should handle it and provide useful message like

Fatal error: Something went wrong. Google responded with a status-code:403 message:Daily Limit Exceeded

dolanmiu commented 8 years ago

Hi very sorry, only saw this issue just now

Yeah make a pull request and I'll release an update later