Published 2023-12-27.
Time to read: 1 minutes.
jekyll_plugins
collection.
This Jekyll plugin provides two tags that include a Google Translate pull-down into a web page.
The {% google_translate_html %}
tag must be called to insert HTML into the page,
then the {% google_translate_javascript %}
tag must be called to insert Javascript into the page.
Installation
Add the following highlighted line to your Jekyll project's Gemfile
,
within the jekyll_plugins
group:
group :jekyll_plugins do gem 'jekyll_google_translate' end
And then execute:
$ bundle
Copy demo/assets/css/jekyll_google_translate.css
to your Jekyll web site’s CSS directory,
and update your layout accordingly.
Usage
<!DOCTYPE html> <html lang="{{ site.lang | default: "en-US" }}"> <head> <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: nowMillis }}" type="text/css"> <link rel="stylesheet" href="{{ '/assets/css/jekyll_google_translate.css?v=' | append: nowMillis }}" type="text/css"> </head> <body> <nav id="sidebar"> {% google_translate_html %} </nav> </body> {% google_translate_javascript %} </html>
The above is usually incorporated into a layout, for example, _layouts/default.html
.