Skip to content
Snippets Groups Projects
Commit 653dc3e1 authored by Huste, Tobias's avatar Huste, Tobias
Browse files

Merge branch 'multilingual' into 'master'

Enable multilingualism of the content of selected pages

See merge request hifis/hifis.net!22
parents ccb444ab c4b407b6
No related branches found
No related tags found
1 merge request!22Enable multilingualism of the content of selected pages
Showing
with 104 additions and 12 deletions
......@@ -17,9 +17,12 @@ directory:
vendor: /assets/vendor/
videos: /assets/videos/
languages: ["en", "de"]
# Defaults
default:
title_image: hifis_page_title_background.svg
title_image: hifis_page_title_background.svg
lang: en
defaults:
-
......@@ -39,7 +42,18 @@ defaults:
type: "posts"
values:
author: "HIFIS"
-
scope:
path: ""
values:
lang: "en"
-
scope:
path: "de"
values:
lang: "de"
hidden: true
gitlab:
project_url: https://gitlab.hzdr.de/hifis/hifis.net
......
en:
global:
lang-selector: "The content of this site is also available in other languages:"
lang-de: Deutsch
lang-en: English (US)
de:
global:
lang-selector: "Dieser Inhalt ist auch in anderen Sprachen verfügbar:"
lang-de: Deutsch
lang-en: English (US)
......@@ -28,7 +28,9 @@
{% if include.categories.size > 0 %}
<h3><i class="fas fa-list"></i> Categories:</h3>
{% for category in include.categories %}
{%- unless site.languages contains category -%}
<span class="badge badge-pill badge-secondary">{{ category | capitalize }}</span>
{%- endunless -%}
{% endfor %}
{% endif %}
......
......@@ -27,7 +27,11 @@
</span>
<span class="badge badge-dark">
<i class="fas fa-tag" aria-hidden="true"></i>
{{ include.post.categories[0] | capitalize }}
{%- for category in include.post.categories -%}
{%- unless site.languages contains category -%}
{{ category | capitalize }}
{%- endunless -%}
{%- endfor -%}
</span>
</div>
<div class="card-body">
......
{%- assign posts=site.posts | where:"lang_ref", page.lang_ref | where_exp: "post", "page.lang != post.lang" | sort: 'path' -%}
{%- assign pages=site.pages | where:"lang_ref", page.lang_ref | where_exp: "item", "page.lang != item.lang" | sort: 'path' -%}
{%- if posts.size > 0 -%}
{% assign items = posts %}
{%- else -%}
{% assign items = pages %}
{%- endif -%}
{%- comment -%}
Only grab elements from the post list, that are the equivalent according to
the lang_ref metadata. Also ensure, that only posts are grabbed that have a
different language.
{%- endcomment -%}
{%- assign t = site.data._i18n.translations[page.lang]['global'] -%}
<p class="text-right">
{%- for item in items -%}
{%- assign language_text = "lang-" | append: item.lang -%}
{%- if forloop.first -%}
<i class="fas fa-globe-europe"></i>&nbsp;<i>{{ t['lang-selector'] }}&nbsp;</i>
{%- endif -%}
<a href="{{ item.url | relative_url }}">{{ t[language_text] }}</a>
{%- unless forloop.last -%}
&nbsp;|&nbsp;
{%- endunless -%}
{%- endfor -%}
</p>
......@@ -8,3 +8,11 @@
<link rel="stylesheet" href="{{ '/assets/css/fontawesome.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/modernizr.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/hifis.css' | relative_url }}">
{%- assign posts = site.posts | where:"lang_ref", page.lang_ref -%}
{%- for post in posts -%}
<link rel="alternate" hreflang="{{ post.lang }}" href="{{ post.url | relative_url }}">
{%- endfor -%}
{%- assign pages = site.pages | where:"lang_ref", page.lang_ref -%}
{%- for page in pages -%}
<link rel="alternate" hreflang="{{ page.lang }}" href="{{ page.url | relative_url }}">
{%- endfor -%}
......@@ -7,7 +7,7 @@
accordingly. In contrast, if everything goes well,
Modernizr will remove that special class.
{% endcomment %}
<html lang="en-US" class="modernizr-no-js">
<html lang="{{ page.lang }}" class="modernizr-no-js">
<head>
{% include minimal_head.html %}
......
......@@ -26,6 +26,7 @@
handling certain scenarios in markdown.
{% endcomment %}
<article class="non-excerpt-content">
{%- include language-selector.html -%}
{{ content }}
</article>
</section>
......
......@@ -9,6 +9,7 @@
<section>
<article>
{%- include language-selector.html -%}
{{ content }}
</article>
</section>
......
......@@ -21,14 +21,20 @@
{% endif %}
<h1>News</h1>
<div class="flex-cards">
{% for post in site.posts limit:5 %}
{% if forloop.index < 4 -%}
{% assign class="" %}
{% else -%}
{% assign class="hide-on-mobile" %}
{% endif -%}
{% include cards/post_card_image.html post=post class=class %}
{% endfor %}
{%- assign posts = site.posts | where:"lang", site.default.lang -%}
{%- for post in posts limit:5 -%}
{%- assign post_translated = site.categories[page.lang] | where_exp: "item", "post.lang_ref == item.lang_ref" | first -%}
{%- if forloop.index < 4 -%}
{%- assign class="" -%}
{%- else -%}
{%- assign class="hide-on-mobile" -%}
{%- endif -%}
{%- if post_translated -%}
{%- include cards/post_card_image.html post=post_translated class=class -%}
{%- else -%}
{%- include cards/post_card_image.html post=post class=class -%}
{%- endif -%}
{%- endfor -%}
</div>
<a href="{{ 'news/' | relative_url }}" class="btn btn-outline-secondary">More</a>
</section>
......
......@@ -10,6 +10,8 @@ categories:
excerpt:
The Jülich Supercomputing Center (JSC) offers computing time and support
on its HPC facilities for research on the COVID-19 virus.
lang: en
lang_ref: 2020-03-13-jsc-hpc-support-for-covid-19-research
---
{{ page.excerpt }}
......
......@@ -8,6 +8,8 @@ layout: blogpost
categories:
- news
excerpt_separator: <!--more-->
lang: en
lang_ref: 2020-04-06-hifis-support-folding-at-home
---
The Helmholtz platform HIFIS, the HZDR and the Center for Advanced Systems
......
......@@ -11,6 +11,8 @@ excerpt:
Since end of March, the Grid Computing Centre Karlsruhe and the HPC systems
of KIT support the distributed computing projects Folding@Home and Rosetta@home,
helping to improve the understanding of proteins, including those of SARS-CoV-2.
lang: en
lang_ref: 2020-04-08-kit-supports-distributed-protein-computing-projects
---
Since end of March, the
......
......@@ -11,6 +11,8 @@ excerpt:
"HIFIS workshop cluster in spring and autumn 2020: Basic Software Carpentry,
Introduction to GitLab and Bring Your Own Script. Specialized workshops
are being planned: Catch them all by keeping an eye on our events page!"
lang: en
lang_ref: 2020-04-15-hifis-software-workshops-in-2020
---
Several different software development trainings will be offered to researchers.
......
......@@ -14,6 +14,8 @@ redirect_from:
excerpt:
Whenever you choose and set up a chat system you should as well implement a
netiquette and best practices for you and your team members from the start.
lang: en
lang_ref: 2020-05-15-guidelines-for-chatting
---
## Scope
......
......@@ -19,6 +19,8 @@ excerpt:
Using a video conferencing tool shall not hamper an effective meeting and
should be used to make the virtual get-together as efficient as possible when
participants are not at the same place.
lang: en
lang_ref: 2020-05-15-guidelines-for-video-conferencing
---
## Scope
......
......@@ -12,6 +12,8 @@ excerpt:
Using common HIFIS authorization and authentication infrastructure
(future Helmholtz AAI), users can simply sign in using personal access data
of their home institution or even their personal GitHub account.
lang: en
lang_ref: 2020-06-01-hifis-software-helpdesk-launched
---
The [HIFIS Software Helpdesk](https://hifis-help.hzdr.de) has been launched.
......
......@@ -8,6 +8,8 @@ layout: blogpost
categories:
- news
excerpt_separator: <!--more-->
lang: en
lang_ref: 2020-06-19-hifis-in-the-egi-newsletter
---
_Helmholtz Federated IT Services - Promoting IT based science at all levels_,
......
......@@ -19,6 +19,8 @@ excerpt:
follow the note taking directly but also to contribute when misunderstandings,
misinterpretations, delays in record keeping and other obstacles hinder the
success of a joint meeting.
lang: en
lang_ref: 2020-06-26-guidelines-for-collaborative-notetaking
---
## Scope
......
......@@ -8,6 +8,8 @@ layout: blogpost
categories:
- news
excerpt_separator: <!--more-->
lang: en
lang_ref: 2020-07-08-haicore-kit
---
A super-fast computer system dedicated to [Helmholtz artificial intelligence (AI)](https://www.helmholtz.ai/) research has been installed at [KIT](https://www.kit.edu).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment