Skip to content

Commit

Permalink
Merge pull request #2 from atomoil/master
Browse files Browse the repository at this point in the history
fix(yandex): fix error with deeply nested objects
  • Loading branch information
KhaledMohamedP authored Apr 10, 2017
2 parents 38f3ae7 + 07bff10 commit d9853a2
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 d9853a2

Please sign in to comment.