Translate Column

Hi,

Is there someone who did a Yes code column to translate another column ?

Thank you

2 Likes

Thee we I would be a lovely add-on to Glide apps - great idea!

Here you go: https://replit.com/@dvdsgl/glide-translate-column

CleanShot 2021-08-19 at 11.16.45

14 Likes

excellent,
thanks david

1 Like

Amazing thanks a lot @david

1 Like

If I can afford Master David,
as it is a paid API (well after a while), is it possible to add a Cache, to avoid a call to the API each time the YC column is refreshed

2 Likes

I have forked the code (big thanks :star2:) but my forked version (unchanged from the fork) does not allow me to save - any ideas?

(and I am putting my own API key in :slight_smile:
Thanks!


It is possible.

1 Like

Hi @Mark_Turrell
(it’s late for david :sleeping: )
Maybe I can answer you.
For the 1st image, rename manifest.json to glide.json

For the 2nd
Test with lowercase “fr”

@Mark_Turrell it also looks like you are using my repl still.

Can’t remember how to convert a format
“C&#39 ;est super ce truc” in
“C’est super ce truc”

We have encodeURI to encode, to reverse this does decodeURI help?

Hi @ThinhDinh
no it didn’t work

The Google translation API probably has a parameter to control the response format. By default this looks like HTML escaped text.

1 Like

I did a test with this, but it’s still pariel.

“Content-Type: application/json; charset=utf-8”

That’s not the API.

It’s me then :slight_smile:
I’m not having much luck with Google APIs :drooling_face:

Well I made an old-fashioned conversion


function unicode2Ascii(str) {
  var code = str.match(/&#(\d+);/g);
  if (code === null) {
    return str;
  }
  for (var i = 0; i < code.length; i++) {
    str = str.replace(code[i], String.fromCharCode(code[i].replace(/[&#;]/g, '')));
  }
  return str;
}
1 Like

I allowed myself to add my personal touch to the excellent code of @David.
In particular a small ‘cache’, the selection of the client’s local language and a Unicode to Ascii conversion.

YC link
https://glide-translate-column-Modif.manun2.repl.co

YC Souce

12 Likes

“C’est vraiment super ce truc” :wink: Thanks @Manu.n for you code

2 Likes