Skip to content

Commit

Permalink
do lang same as my PR to Chirpy:
Browse files Browse the repository at this point in the history
  • Loading branch information
neilboyd committed Mar 2, 2024
1 parent c047319 commit c660f8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions _includes/lang.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% comment %}
Detect appearance language and return it through variable "lang"
{% endcomment %}

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

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

Expand Down Expand Up @@ -76,10 +75,10 @@

<!-- JavaScripts -->

{% include js-selector.html %}
{% include js-selector.html lang=lang %}

{% if page.mermaid %}
{% include mermaid.html %}
{% include mermaid.html lang=lang %}
{% endif %}

{% include_cached search-loader.html lang=lang %}
Expand Down

0 comments on commit c660f8b

Please sign in to comment.