summaryrefslogtreecommitdiff
path: root/_includes
diff options
context:
space:
mode:
Diffstat (limited to '_includes')
-rw-r--r--_includes/extensions/google-translate.html93
-rw-r--r--_includes/views/banner.html4
-rw-r--r--_includes/views/header.html3
3 files changed, 11 insertions, 89 deletions
diff --git a/_includes/extensions/google-translate.html b/_includes/extensions/google-translate.html
index 830575a..5eacacf 100644
--- a/_includes/extensions/google-translate.html
+++ b/_includes/extensions/google-translate.html
@@ -13,9 +13,14 @@
<ul class="list-unstyled ct-language-dropdown">
{% for item in translate_langs %}
<li>
- <a href="#" class="lang-select" data-lang="{{ item.lang }}">
- {% if item.img %}
- <img src="{{ item.img }}" title="{{ item.text }}">
+ {% if item.lang == 'es' %}
+ {% capture page_url %}{{ site.baseurl_root }}{{ page.url }}{% endcapture %}
+ {% else %}
+ {% capture page_url %}{{ site.baseurl_root }}/{{ item.lang }}{{ page.url}}{% endcapture %}
+ {% endif %}
+ <a href="{{ page_url }}" class="lang-select">
+ {% if item.img %}
+ <img src="{{ item.img }}" title="{{ item.text }}">
{% else %}
{{ item.text }}
{% endif %}
@@ -24,85 +29,3 @@
{% endfor %}
</ul>
</span>
-
-<script type="text/javascript">
-function googleTranslateElementInit() {
- new google.translate.TranslateElement({
- pageLanguage: '{{ lang }}',
- autoDisplay: false,
- layout: google.translate.TranslateElement.InlineLayout.VERTICAL
- }, 'google_translate_element');
-
- // Links to cross-origin destinations are unsafe
- var gll = document.getElementsByClassName('goog-logo-link')[0];
- if (gll) {
- gll.setAttribute('rel', 'noopener');
- }
-
- function restoreLang() {
- var iframe = document.getElementsByClassName('goog-te-banner-frame')[0];
- if (!iframe) return;
-
- var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
- var restore_el = innerDoc.getElementsByTagName("button");
-
- for (var i = 0; i < restore_el.length; i++) {
- if (restore_el[i].id.indexOf("restore") >= 0) {
- restore_el[i].click();
- var close_el = innerDoc.getElementsByClassName("goog-close-link");
- close_el[0].click();
- return;
- }
- }
- }
-
- function triggerHtmlEvent(element, eventName) {
- var event;
- if (document.createEvent) {
- event = document.createEvent('HTMLEvents');
- event.initEvent(eventName, true, true);
- element.dispatchEvent(event);
- } else {
- event = document.createEventObject();
- event.eventType = eventName;
- element.fireEvent('on' + event.eventType, event);
- }
- }
-
- var googleCombo = document.querySelector("select.goog-te-combo");
- var langSelect = document.querySelector('.ct-language');
- langSelect.addEventListener('click', function(event) {
- if (!event.target) {
- return;
- }
-
- var selected = document.querySelector('.ct-language .ct-language-selected');
- if (selected) {
- selected.classList.remove('ct-language-selected');
- }
-
- var target = event.target;
- while (target && target !== langSelect ) {
- if (target.matches('.lang-select')) {
- break;
- }
- target = target.parentElement;
- }
-
- if (target && target.matches('.lang-select')) {
- var lang = target.getAttribute('data-lang');
- if (googleCombo.value == lang) {
- restoreLang();
- } else {
- target.parentElement.classList.add('ct-language-selected');
- googleCombo.value = lang;
- triggerHtmlEvent(googleCombo, 'change');
- }
- }
-
- event.preventDefault();
- });
-}
-</script>
-
-<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" async></script>
diff --git a/_includes/views/banner.html b/_includes/views/banner.html
index 1db45a5..bd3205c 100644
--- a/_includes/views/banner.html
+++ b/_includes/views/banner.html
@@ -116,10 +116,10 @@
<div class="page-banner-default">
<h1 class="page-banner-heading">
- {{ heading | default: page.title | escape }}
+ {% t home.heading %}
</h1>
<h2 class="page-banner-subheading">
- {{ subheading | default: page.subtitle | escape }}
+ {% t home.subheading %}
</h2>
</div>
diff --git a/_includes/views/header.html b/_includes/views/header.html
index c43d7ec..d022c16 100644
--- a/_includes/views/header.html
+++ b/_includes/views/header.html
@@ -1,4 +1,3 @@
-
{%- include functions.html func='get_banner' -%}
{%- include functions.html func='log' level='debug' msg='Get header_transparent value' -%}
@@ -36,7 +35,7 @@
{%- for path in page_paths -%}
{%- assign my_page = site.pages | where: "path", path | first -%}
{%- if my_page.title -%}
- <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | upcase | escape }}</a>
+ <a class="page-link" href="{{ my_page.url | relative_url }}">{% t my_page.title %}</a>
{%- endif -%}
{%- endfor -%}