а
translate('Hello world', 'es').then(text => {
console.log(text); // Hola mundo
});
Example with an async workflow:
const whatever = async () => {
const text = await translate('こんにちは世界', { from: 'ja', to: 'es' });
console.log(text); // Hola mundo
};