fix: inaccurate google translation behavior (#55)
This commit is contained in:
parent
f06b7b0e62
commit
9ecb45bd4e
2 changed files with 8 additions and 1 deletions
|
@ -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');
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue