How to translate your website into Japanese?
RixTheTyrunt

Hello, I am doing a website, which can be translate WHOLE into Japanese. So, I want to ask you: Is it possible to translate your website ONLY to Japanese ( Also no Google Translate, cause it has many languages to translate. ) I tried <html lang="jp"> but it didn't do anything.

You are viewing a single comment. View All
CoderGautamYT

You would probably want to make a javascript code that iterates through each text element and sends it to google translates api for japanese, and updates the text element with the response.

RixTheTyrunt

But, how to get response from other webs?

CoderGautamYT

Using the fetch api. Hold on, working on an example to show you. @RixTheTyrunt

CoderGautamYT

Here, I have made a function which you can use to translate into any language (your case, japanese). Here it is: https://replit.com/@CoderGautamYT/googletranslateapi

Just copy the function in api.js and use the function as shown in script.js. If you need any help, reply here.
@RixTheTyrunt

RixTheTyrunt

translate is not defined error.

RixTheTyrunt

I fixed that error, now the only thing is: It doesn't translate

RixTheTyrunt

Wait, why does it show TypeError: Failed to fetch in the body?!

CoderGautamYT

I'm forking and fixing it, hold on. @RixTheTyrunt

CoderGautamYT

I will send u fixed code @RixTheTyrunt

RixTheTyrunt

Oh, OK!

CoderGautamYT
RixTheTyrunt

Update the code, I almost every time edit it, so... Watch out.

CoderGautamYT

Ok, I think google is somehow detecting the request, I think using a node.js server should help, hold on... im making [email protected]

GautamSudarshan

Hey its me CoderGautam on a different account, I used a different method to do your website, see if this works for you. https://replit.com/@GautamSudarshan/EarlyMatureGreenware#index.html @RixTheTyrunt