Skip to content

Commit

Permalink
simplify example
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-fei committed Dec 29, 2019
1 parent 0bcaced commit 90db550
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,7 @@ main()
.then(() => process.exit(0))

async function main () {
const toTranslate = [{
text: 'ciao, come stai?', from: 'it', to: 'en'
}, {
text: 'hey', from: 'en', to: 'es'
}, {
text: 'one apple a day keeps the doctor away', from: 'en', to: 'de'
}, {
text: 'one apple a day keeps the doctor away', to: 'de'
}]
for (const params of toTranslate) {
console.log(`Translating "${params.text}" from "${params.from || 'auto'}" to "${params.to}"`)
const translation = await translate(params)
console.log(`-> "${translation}"`)
}
const translation = await translate({ text: 'ein apfel am tag hält den arzt fern', from: 'it', to: 'en' })
console.log(`-> "${translation}"`) // one apple a day keeps the doctor away
}
```

0 comments on commit 90db550

Please sign in to comment.