Skip to content
This repository has been archived by the owner on Aug 27, 2020. It is now read-only.

Commit

Permalink
Configure i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihisil committed Jul 6, 2020
1 parent 4c82579 commit ff9e24f
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 12 deletions.
6 changes: 0 additions & 6 deletions hugo/archetypes/default.md

This file was deleted.

22 changes: 18 additions & 4 deletions hugo/config.toml
@@ -1,7 +1,21 @@
baseURL = "http://example.org/"
languageCode = "en-us"
title = "Mahjogn Wiki"
theme = "wiki"

[params]
description = "Mahjogn Wiki"
languageCode = "en-us"
defaultContentLanguage = "en"

[languages]
[languages.en]
languageName = "English"
weight = 1

title = "Mahjogn Wiki"
description = "Mahjogn Wiki"
contentDir = "content/english"
[languages.ru]
languageName = "Русский"
weight = 2

title = "Маджонг wiki"
description = "Маджонг wiki"
contentDir = "content/russian"
File renamed without changes.
2 changes: 2 additions & 0 deletions hugo/content/russian/_index.md
@@ -0,0 +1,2 @@
# Главная страница
Пока тут ничего нет.
5 changes: 5 additions & 0 deletions hugo/i18n/en.toml
@@ -0,0 +1,5 @@
[translations]
other = "Translations of this page"

[main_page]
other = "Main page"
5 changes: 5 additions & 0 deletions hugo/i18n/ru.toml
@@ -0,0 +1,5 @@
[translations]
other = "Переводы этой страницы"

[main_page]
other = "Главная страница"
1 change: 1 addition & 0 deletions hugo/themes/wiki/layouts/_default/baseof.html
Expand Up @@ -7,6 +7,7 @@
<div class="container">
<div class="row justify-content-start">
<div class="col">
{{- partial "i18nlist.html" . -}}
{{- block "main" . }}{{- end }}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions hugo/themes/wiki/layouts/partials/header.html
@@ -1,6 +1,6 @@
<header>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">{{ .Site.Title }}</a>
<a class="navbar-brand" href="/">{{ .Site.Title }}</a>
<button
class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"
Expand All @@ -10,7 +10,7 @@
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">Home</a>
<a class="nav-link" href="/">{{ i18n "main_page" }}</a>
</li>
</ul>
</div>
Expand Down
8 changes: 8 additions & 0 deletions hugo/themes/wiki/layouts/partials/i18nlist.html
@@ -0,0 +1,8 @@
{{ if .IsTranslated }}
<span>
{{ i18n "translations" }}:
{{ range .Translations }}
<a href="{{ .Permalink }}">{{ .Lang }}</a>
{{ end }}
</span>
{{ end }}

0 comments on commit ff9e24f

Please sign in to comment.