Dynamically translate between languages using Google machine learning
Google Cloud Translate API can be used to build applications that can translate
between languages. Some examples of applications that can be built using Google
Cloud Translate API include:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
google_cloud_translate: {
type: "app",
app: "google_cloud_translate",
}
},
async run({steps, $}) {
const data = {
"q": `¡hola mundo!`,
"target": `en`,
}
return await axios($, {
method: "post",
url: `https://translation.googleapis.com/language/translate/v2?key=${this.google_cloud_translate.$auth.api_key}`,
headers: {
"Content-Type": `application/json; charset=utf-8`,
},
data,
})
},
})
export default defineComponent({
async run({ steps, $ }) {
const text = ' Hello world! ';
return text.trim()
},
})