Next.js Discord

Discord Forum

Disable Google Translation

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
Is ther a way to disable this in next js
i dont want user to change languages from google translate

previously i was doing this
<html translate="no" >

i tried same with next it doesnt work
it doesnot translate but still it pops up
Answered by Ray
export const metadata: Metadata = {
  other: {
    google: "notranslate"
  }
}
View full answer

28 Replies

you can click the 3 dots and click on "never translate ..." @Asiatic Lion
Asiatic LionOP
but not all the users will do this @B33fb0n3
the translation seems like a browser behavior. So your page can't change it. The thing that you already done is to set the language your page is based of inside the language part of your html. Then google can better understand your page
Asiatic LionOP
but even if i give lang={locale} it stills prompts the pop up which is annoying
the translation seems like a browser behavior.
Only the client can change it
Asiatic LionOP
and my website is focused mainly on arabic langugae if they press translate with google the fonts are really ugly and user dont like it that was the reason we disabled it in our previous
the language files (your translations) should only deliver data. So the user can have any language and he won't use the translation from google
Asiatic LionOP
there is a button to cahnge language in my website
yes
Asiatic LionOP
but my users are dumb like me they dont see the button first they will change on the google pop up and the whole layout of page is messed up
cause arabic needs rtl if they choose from popup it change the direction
Asiatic LionOP
i added translation="no" in every html tag i have in the app but still the stupid pops up
and also added this one?
<meta name="google" content="notranslate" />
and this class to your html?
class="notranslate"
Asiatic LionOP
i added the meta but not class
let me try with class as well
weell something like this
?
are you using the app dir?
Asiatic LionOP
yes @B33fb0n3
mf className also doesnt seem to be working
then you can't use the Head Tag. You need to apply the meta with the static meta method. You can read about it here: https://nextjs.org/docs/app/building-your-application/optimizing/metadata#static-metadata
Asiatic LionOP
Ill will try after lunch
@B33fb0n3 and also added this one? <meta name="google" content="notranslate" />
Asiatic LionOP
@B33fb0n3 there is no way we can add this metadata in the import type { Metadata } from "next";
there should be anohter way to do this
@Asiatic Lion <@301376057326567425> there is no way we can add this metadata in the `import type { Metadata } from "next";`
export const metadata: Metadata = {
  other: {
    google: "notranslate"
  }
}
Answer
Asiatic LionOP
Oooooo thanks