dictcc
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)
dictcc
is a client for the dict.cc dictionary service. It
returns a list of translations for a given term for a given source and target
language.
Installation
npm i dictcc
yarn add dictcc
Usage Example
import translate, { Languages } from 'dictcc'
const getTranslation = async () => {
const { data, error, url } = await translate({
sourceLanguage: Languages.en,
targetLanguage: Languages.de,
term: 'home',
})
return data
}
A result looks something like this:
[
{
"sourceTranslation": {
"text": "home",
"meta": {
"abbreviations": [],
"comments": ["at home"],
"optionalData": [],
"wordClassDefinitions": ["adv"]
}
},
"targetTranslation": {
"text": "daheim",
"meta": {
"abbreviations": [],
"comments": ["bes. südd., österr. u. schweiz."],
"optionalData": [],
"wordClassDefinitions": []
}
},
"targetTranslationAudioUrl": "https://www.example.com/audio/daheim.mp3"
}
]
License
MIT
Contributors ✨
Thanks goes to these wonderful people
(emoji key):
This project follows the
all-contributors
specification. Contributions of any kind welcome!