Skip to content

Instantly share code, notes, and snippets.

@joepie91
Forked from dsauerbrun/.js
Last active August 26, 2015 21:48
Show Gist options
  • Save joepie91/d124bbaa2d429df1ce06 to your computer and use it in GitHub Desktop.
Save joepie91/d124bbaa2d429df1ce06 to your computer and use it in GitHub Desktop.
function buildTranslations(message, originLanguage, destLanguages){
return Promise.try(function(){
translations = {};
destLanguages.map(function(currentLang){
translations[currentLang.code] = {}
db.model('Translation').translate(message,originLanguage.code,currentLang.code).then(function(translation){
console.log('build Trans function'+translation);
translations[currentLang.code] = translation;
});
});
return translations;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment