Skip to content

Commit

Permalink
fix(yandex): fix error with deeply nested objects
Browse files Browse the repository at this point in the history
 (e.g. objects which only contain objects, and no strings)
  • Loading branch information
Adam Hoyle committed Apr 6, 2017
1 parent 38f3ae7 commit ce1f382
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/service/yandex.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ function translateString(language, key, destObj) {

return new Promise(function (resolve, reject) {
var valuesStr = valuesArray.join(hashSimple);
if (valuesStr === ''){
// there is nothing to translate, so don't ask Yandex (Yandex will respond with an error)
resolve(destObj);
return;
}
translateService.translate(valuesStr, {to: language}, function (err, res) {
if (err || !res) {
reject('Yandex translation service failed', err);
Expand Down

0 comments on commit ce1f382

Please sign in to comment.