xxxxxxxxxx
//You can use an api, adapting it to what you exactly need. As example is rapidApi,
//which is free to use.
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://nlp-translation.p.rapidapi.com/v1/translate',
params: {text: 'Hello, world!!', to: 'es', from: 'en'},
headers: {
'x-rapidapi-host': 'nlp-translation.p.rapidapi.com',
'x-rapidapi-key': 'c31cfcc8d1msh640834c65d07074p1022b9jsn451d8d5fa97c'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
xxxxxxxxxx
const sourceText = 'Hello, world!';
const targetLanguage = 'fr';
const translation = new Intl
.DisplayNames([targetLanguage], {type: 'language'})
.of(targetLanguage);
console.log(`Translation (${targetLanguage}): ${translation} => ${sourceText}`);
xxxxxxxxxx
function Dancing(this_sprite) {
moveForward(this_sprite, 5);
if (isTouchingEdges(this_sprite)) {
edgesDisplace(this_sprite);
changePropBy(this_sprite, "direction", 180);
}
}
function math_random_int(a, b) {
if (a > b) {
// Swap a and b to ensure a is smaller.
var c = a;
a = b;
b = c;
}