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] other strings in the templates
- [x] localized RSS links - [x] localized RSS links
- [ ] links to navigate between languages - [ ] links to navigate between languages
- [ ] support generic default_language (not en by default) - [x] support generic default_language (not en by default)
- [ ] other - [ ] other
- [x] ASCII banner does not overflow - [x] ASCII banner does not overflow
- [x] write setup/configuration guide - [x] write setup/configuration guide

View File

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

View File

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

View File

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