Nhúng Google Dịch Vào Website - GitHub

Skip to content Search Gists Search Gists All gists Back to GitHub Sign in Sign up Sign in Sign up Dismiss alert {{ message }}

Instantly share code, notes, and snippets.

@kythuatwebso kythuatwebso/google-translate-for-website.txt Created June 16, 2021 07:45 Show Gist options
  • Star (0) You must be signed in to star a gist
  • Fork (0) You must be signed in to fork a gist
  • Embed Select an option
    • Embed Embed this gist in your website.
    • Share Copy sharable link for this gist.
    • Clone via HTTPS Clone using the web URL.

    No results found

    Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/kythuatwebso/acf4074f894a49e730d71e8dec0c99fd.js"></script>
  • Save kythuatwebso/acf4074f894a49e730d71e8dec0c99fd to your computer and use it in GitHub Desktop.
Code Revisions 2 Embed Select an option
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.

No results found

Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/kythuatwebso/acf4074f894a49e730d71e8dec0c99fd.js"></script> Save kythuatwebso/acf4074f894a49e730d71e8dec0c99fd to your computer and use it in GitHub Desktop. Download ZIP Nhúng Google dịch vào Website Raw google-translate-for-website.txt This file contains hidden or 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 Show hidden characters
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@kythuatwebso Copy link Author

kythuatwebso commented Oct 29, 2021

{* GOOGLE DICH *} {literal} <script type="text/javascript"> var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if (width >= 768) { function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'vi', includedLanguages : 'vi,en'}, 'google_translate_desktop'); } } else { function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'vi', includedLanguages : 'vi,en'}, 'google_translate_mobile'); } } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"> </script> {/literal}

Uh oh!

There was an error while loading. Please reload this page.

@kythuatwebso Copy link Author

kythuatwebso commented Oct 29, 2021

Nhúng vào head.tpl

và chèn div với id: google_translate_desktop vào nơi cần hiển thị

Uh oh!

There was an error while loading. Please reload this page.

@kythuatwebso Copy link Author

kythuatwebso commented Apr 14, 2022 edited Loading

Uh oh!

There was an error while loading. Please reload this page.

CSS:

#google_translate_desktop, #google_translate_mobile { padding-top: 3px; height: 28px; overflow: hidden; }

Uh oh!

There was an error while loading. Please reload this page.

@kythuatwebso Copy link Author

kythuatwebso commented Apr 14, 2022

Plugin:

https://gtranslate.io/

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment You can’t perform that action at this time.

Từ khóa » Chèn Google Dịch Vào Website