generated from sanity-io/template-nextjs-personal-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor FooterLayout component and add GTranslate component
- Loading branch information
1 parent
c4b5532
commit 2f610e0
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"use client"; | ||
import React from "react"; | ||
import { Helmet } from "react-helmet"; | ||
function GTranslate() { | ||
return ( | ||
<div> | ||
{/* Your component content here */} | ||
|
||
{/* Add the following Helmet component to include the script in the head */} | ||
<Helmet> | ||
<script type="text/javascript"> | ||
{` | ||
function googleTranslateElementInit() { | ||
new google.translate.TranslateElement( | ||
{pageLanguage: 'en'}, | ||
'google_translate_element' | ||
); | ||
} | ||
`} | ||
</script> | ||
<script | ||
async | ||
type="text/javascript" | ||
src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" | ||
></script> | ||
</Helmet> | ||
<div id="google_translate_element"></div> | ||
</div> | ||
); | ||
} | ||
|
||
export default GTranslate; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters