Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
neilboyd authored and cotes2020 committed Mar 4, 2024
1 parent b549aa1 commit bad5c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions _includes/lang.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% comment %}
Detect appearance language and return it through variable "lang"
{% endcomment %}
{% assign lang = page.lang | default: site.lang %}

{% unless site.data.locales[lang] %}
{% if site.data.locales[page.lang] %}
{% assign lang = page.lang %}
{% elsif site.data.locales[site.lang] %}
{% assign lang = site.lang %}
{% else %}
{% assign lang = 'en' %}
{% endunless %}
{% endif %}
3 changes: 2 additions & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %}
{% endif %}

<html lang="{{ lang }}" {{ prefer_mode }}>
<!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="{{ page.lang | default: site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}

<body>
Expand Down

0 comments on commit bad5c4a

Please sign in to comment.