diff options
-rw-r--r-- | _includes/extensions/google-translate.html | 6 | ||||
-rw-r--r-- | _includes/views/header.html | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/_includes/extensions/google-translate.html b/_includes/extensions/google-translate.html index ce1ef94..9763315 100644 --- a/_includes/extensions/google-translate.html +++ b/_includes/extensions/google-translate.html @@ -2,6 +2,10 @@ {% assign translate_langs = include.translate_langs %} {% endif %} +{% if include.lang %} + {% assign lang = include.lang %} +{% endif %} + <div id="google_translate_element" style="display: none;"> </div> @@ -24,7 +28,7 @@ <script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({ - pageLanguage: '', + pageLanguage: '{{ lang }}', autoDisplay: false, layout: google.translate.TranslateElement.InlineLayout.VERTICAL }, 'google_translate_element'); diff --git a/_includes/views/header.html b/_includes/views/header.html index ba707b0..c43d7ec 100644 --- a/_includes/views/header.html +++ b/_includes/views/header.html @@ -44,6 +44,9 @@ {%- include functions.html func='get_value' -%} {%- assign translate_langs = return -%} {%- if translate_langs.size > 0 -%} + {%- assign name = 'lang' -%} + {%- include functions.html func='get_value' default='en' -%} + {%- assign lang = return -%} <span class="page-link"> {%- include extensions/google-translate.html -%} </span> |