Skip to content

Commit

Permalink
Set all tokens and translation links needed by workshop layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Aug 8, 2019
1 parent 199316c commit 84dee0a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
6 changes: 3 additions & 3 deletions _includes/workshop_ad.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ <h2>{{page.venue}}</h2>
</div>
<div class="col-md-6">
<p>
<strong>Instructors:</strong>
<strong>{{ include.language.instructors }}:</strong>
{% if page.instructor %}
{{page.instructor | join: ', ' %}}
{% else %}
to be announced.
{{ include.language.tba }}.
{% endif %}
</p>
{% if page.helper %}
<p>
<strong>Helpers:</strong>
<strong>{{ include.language.helpers }}:</strong>
{{page.helper | join: ', ' %}}
</p>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion _includes/workshop_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h4>
</div>
<div class="col-md-6" align="right">
<h4>
<a href="mailto:{{ site.email }}">Contact The Carpentries</a>
<a href="mailto:{{ site.email }}">{{ include.language.contact }}</a>
</h4>
</div>
</div>
Expand Down
26 changes: 22 additions & 4 deletions _layouts/workshop.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,26 @@
{% include base_path.html %}
{% include gh_variables.html %}

{% comment %}
In which language is the current page? Guess from the path: locale="/<lang>/".
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 /<language>/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" %}
{% assign extras = site.locale | where_exp:"item", "item.path contains pathLocale" | where_exp:"item", "item.path contains 'extra'" | sort: "path" %}
{% else %}
{% assign locale = "en" %}
{% assign episodes = site.episodes %}
{% assign extras = site.extras %}
{% 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 %}
{% assign data_language_en = site.pages | where_exp:"page", "page.path contains 'i18n'" | where_exp:"page", "page.path contains 'en.md'" | first %}
<!doctype html>
<html lang="en">
<html lang="{{ locale }}">
<head>

<meta name="slug" content="{{project_title}}" />
Expand Down Expand Up @@ -46,10 +64,10 @@
</head>
<body>
<div class="container">
{% include navbar.html %}
{% include workshop_ad.html %}
{% include navbar.html language=data_language language_en=data_language_en episodes=episodes extras=extras locale=locale %}
{% include workshop_ad.html language=data_language %}
{{ content }}
{% include workshop_footer.html %}
{% include workshop_footer.html language=data_language %}
</div>
{% include javascript.html %}
</body>
Expand Down
3 changes: 3 additions & 0 deletions assets/i18n/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ objectives: "Objectives"
downloadLesson: "Download files required for the lesson"
finish: "Finish"
scheduleDisclaimer: "The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor."
instructors: "Instructors"
helpers: "Helpers"
tba: "to be announced"
---
3 changes: 3 additions & 0 deletions assets/i18n/es.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ objectives: Objectivos
downloadLesson: "Descarga los ficheros necesarios para la lección"
finish: "Fin"
scheduleDisclaimer: El horario durante la lección puede variar a según los temas y preguntas que eliga el instructor.
instructors: "Instructores"
helpers: "Ayudantes"
tba: "Aún pendiente"
---

0 comments on commit 84dee0a

Please sign in to comment.