From edce5ff9dfda70603824c73928473dd62227c2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20P=C3=A9rez-Su=C3=A1rez?= Date: Sun, 26 Aug 2018 21:39:52 +0100 Subject: [PATCH] Set all tokens and translation links needed by lesson layout --- _includes/main_title.html | 2 +- _includes/syllabus.html | 18 +++++++++--------- _layouts/lesson.html | 17 ++++++++++++++++- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/_includes/main_title.html b/_includes/main_title.html index b08af4a..3479908 100644 --- a/_includes/main_title.html +++ b/_includes/main_title.html @@ -4,4 +4,4 @@ {% include base_path.html %} -

{{ site.title }}{% if page.title %}: {{ page.title }}{% endif %}

+

{{ site.title }}{% if page.title %}{% unless page.path contains 'index' %}: {{ page.title }}{% endunless %}{% endif %}

diff --git a/_includes/syllabus.html b/_includes/syllabus.html index 2bc607e..2c90947 100644 --- a/_includes/syllabus.html +++ b/_includes/syllabus.html @@ -5,12 +5,12 @@ Days are displayed if at least one episode has 'start = true'. {% endcomment %}
-

Schedule

+

{{ include.language.schedule }}

{% assign lesson_number = 0 %} {% assign day = 0 %} {% assign multiday = false %} - {% for episode in site.episodes %} + {% for episode in include.episodes %} {% if episode.start %}{% assign multiday = true %}{% break %}{% endif %} {% endfor %} {% assign current = site.start_time %} @@ -19,10 +19,10 @@

Schedule

{% if multiday %}{% endif %} - Setup - Download files required for the lesson + {{ include.language.setup }} + {{ include.language.downloadLesson }} - {% for episode in site.episodes %} + {% for episode in include.episodes %} {% if episode.start %} {% comment %} Starting a new day? {% endcomment %} {% assign day = day | plus: 1 %} {% if day > 1 %} {% comment %} If about to start day 2 or later, show finishing time for previous day {% endcomment %} @@ -31,7 +31,7 @@

Schedule

{% if multiday %}{% endif %} {% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif %}{{ minutes }} - Finish + {{ include.language.finish }} {% endif %} @@ -48,7 +48,7 @@

Schedule

{% if episode.break %} - Break + {{ include.language.break }} {% else %} {% if episode.questions %} {% for question in episode.questions %} @@ -68,13 +68,13 @@

Schedule

{% if multiday %}{% endif %} {% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif %}{{ minutes }} - Finish + {{ include.language.finish }}

- The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor. + {{ include.language.scheduleDisclaimer }}

diff --git a/_layouts/lesson.html b/_layouts/lesson.html index f3f7300..0dc9f4a 100644 --- a/_layouts/lesson.html +++ b/_layouts/lesson.html @@ -1,8 +1,23 @@ --- layout: base --- +{% comment %} +In which language is the current page? Guess from the path: locale="//". +Load language tockens for menus {{ data_language }}. Translations need to provide a lang.md file that translates what's under _data/language.yaml +Generate list of episodes and extras for the language shown. - NOTE: _extras need in the permlinks //page!! +{% endcomment %} +{% if page.path contains "_locale" %} + {% assign locale = page.path | remove: "_locale/" | split: "/" | first | downcase %} + {% assign pathLocale = locale | append: '/' | prepend: '/' %} + {% assign episodes = site.locale | where_exp:"item", "item.path contains pathLocale" | where_exp:"item", "item.path contains 'episode'" | sort: "path" %} +{% else %} + {% assign locale = "en" %} + {% assign episodes = site.episodes %} +{% endif %} +{% assign lang_file = locale | append: '.md' %} +{% assign data_language = site.pages | where_exp:"page", "page.path contains 'i18n'" | where_exp:"page", "page.path contains lang_file" | first %} {% include main_title.html %}
{{ content }}
-{% include syllabus.html %} +{% include syllabus.html language=data_language episodes=episodes %}