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 %}
|
{% assign translate_langs = include.translate_langs %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if include.lang %}
|
||||||
|
{% assign lang = include.lang %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div id="google_translate_element" style="display: none;">
|
<div id="google_translate_element" style="display: none;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -24,7 +28,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function googleTranslateElementInit() {
|
function googleTranslateElementInit() {
|
||||||
new google.translate.TranslateElement({
|
new google.translate.TranslateElement({
|
||||||
pageLanguage: '',
|
pageLanguage: '{{ lang }}',
|
||||||
autoDisplay: false,
|
autoDisplay: false,
|
||||||
layout: google.translate.TranslateElement.InlineLayout.VERTICAL
|
layout: google.translate.TranslateElement.InlineLayout.VERTICAL
|
||||||
}, 'google_translate_element');
|
}, 'google_translate_element');
|
||||||
|
|
|
@ -44,6 +44,9 @@
|
||||||
{%- include functions.html func='get_value' -%}
|
{%- include functions.html func='get_value' -%}
|
||||||
{%- assign translate_langs = return -%}
|
{%- assign translate_langs = return -%}
|
||||||
{%- if translate_langs.size > 0 -%}
|
{%- if translate_langs.size > 0 -%}
|
||||||
|
{%- assign name = 'lang' -%}
|
||||||
|
{%- include functions.html func='get_value' default='en' -%}
|
||||||
|
{%- assign lang = return -%}
|
||||||
<span class="page-link">
|
<span class="page-link">
|
||||||
{%- include extensions/google-translate.html -%}
|
{%- include extensions/google-translate.html -%}
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue