Txhawm rau tsim Google Translate widget, koj yuav tsum suav nrog Google Txhais API tsab ntawv hauv koj lub vev xaib thiab tsim lub thawv rau widget. Nov yog cov kauj ruam:
Tau txais Google Txhais API Key: Txhawm rau siv Google Txhais API, koj yuav tsum muaj Google Cloud account thiab tsim tus yuam sij API.
Suav nrog API tsab ntawv hauv koj HTML: Ntxiv cov lej hauv qab no rau koj cov ntaub ntawv HTML kom suav nrog Google Txhais API.
Tsim ib lub thawv rau lub widget: Tsim a
div
element nrog ib tug tshwj xeebid
uas yuav ua lub thawv rau lub widget. Koj tuaj yeem tso cov khoom no nyob txhua qhov chaw ntawm koj lub vev xaib uas koj xav kom lub widget tshwm.- Pib lub widget: Ntxiv cov lej JavaScript hauv qab no rau koj cov ntaub ntawv HTML kom pib lub widget thiab teeb tsa hom lus.
Koj tuaj yeem hloov'en'
nrog cov lus uas xav tau. - Kuaj cov widget: Xa koj lub vev xaib hauv qhov browser thiab xyuas kom meej tias widget ua haujlwm raug.
Nco tseg: Cov cai no xav tias koj tau nkag mus rau Google Txhais API, uas tsis muaj pub dawb. Yog tias koj tab tom tsim lub vev xaib rau kev lag luam, koj yuav tsum tau them nyiaj rau kev siv API.