Support for non-english default language

master
southerntofu 2020-03-30 20:48:50 +02:00
parent a51d9faac9
commit fff9ece079
4 changed files with 7 additions and 3 deletions

View File

@ -368,7 +368,7 @@ If something is missing for you, please open an issue.
- [x] other strings in the templates
- [x] localized RSS links
- [ ] links to navigate between languages
- [ ] support generic default_language (not en by default)
- [x] support generic default_language (not en by default)
- [ ] other
- [x] ASCII banner does not overflow
- [x] write setup/configuration guide

View File

@ -13,6 +13,7 @@ build_search_index = false
generate_rss = true
# The default language for pages that don't have a language code
default_language = "en"
languages = [
@ -23,8 +24,11 @@ languages = [
# The common part of the title (appended to page/section titles)
title = " | dnsmanager"
[extra.forge]
# The baseURL for files tracked on the forge
browse = "https://tildegit.org/southerntofu/dnsmanager-website/src/branch/master/"
# Homepage of the forge
home = "https://tildegit.org/"
# Name of the forge
name = "tildegit"
[translations]

View File

@ -1,7 +1,7 @@
{% import "widgets.html" as widgets %}
{% set lang = section.lang | default(value=page.lang) %}
<!DOCTYPE html>
<html class="no-js" lang="{{ lang | default(value="en")}}">
<html class="no-js" lang="{{ lang | default(value=config.default_language)}}">
<head>
<meta charset="utf8">
<title>{% block title %}{{ section.title }}{% endblock %}</title>

View File

@ -34,7 +34,7 @@ a submenu. A submenu is an actual list
{% endmacro menu %}
{%- macro i18n_path(path) -%}
{% if lang == "en" %}{{ path }}
{% if lang == config.default_language %}{{ path }}
{%- else -%}
{%- set parts = path | split(pat=".md") -%}
{%- for part in parts -%}