feat(i18n): allow page.lang
to override site.lang
(#1586)
This commit is contained in:
parent
2a7b56bb36
commit
547b95cc7a
3 changed files with 6 additions and 4 deletions
|
@ -33,7 +33,7 @@
|
|||
or page.layout == 'category'
|
||||
or page.layout == 'tag'
|
||||
%}
|
||||
{% assign locale = site.lang | split: '-' | first %}
|
||||
{% assign locale = include.lang | split: '-' | first %}
|
||||
|
||||
{% assign urls = urls
|
||||
| append: ','
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{% comment %}
|
||||
Detect appearance language and return it through variable "lang"
|
||||
{% endcomment %}
|
||||
{% if site.data.locales[site.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' %}
|
||||
|
|
|
@ -13,7 +13,7 @@ layout: compress
|
|||
{% endif %}
|
||||
|
||||
<!-- `site.alt_lang` can specify a language different from the UI -->
|
||||
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
|
||||
<html lang="{{ page.lang | default: site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
|
||||
{% include head.html %}
|
||||
|
||||
<body>
|
||||
|
@ -76,7 +76,7 @@ layout: compress
|
|||
|
||||
<!-- JavaScripts -->
|
||||
|
||||
{% include js-selector.html %}
|
||||
{% include js-selector.html lang=lang %}
|
||||
|
||||
{% if page.mermaid %}
|
||||
{% include mermaid.html %}
|
||||
|
|
Loading…
Reference in a new issue