Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare for localization following Hugo standards #29

Merged
merged 2 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ docs](https://github.com/fsfe/reuse-docs).
Generally, we invite you to contact and join the [REUSE mailing
list](https://lists.fsfe.org/mailman/listinfo/reuse).

### Translation

The website "chrome" strings are localized using the standard,
built-in [Hugo i18n](https://gohugo.io/content-management/multilingual/)
support. Those files are in _data/_.

## License

The theme used for this website is based on [github-project-landing-page](https://github.com/nsomar/github-project-landing-page) which is licensed under the
Expand Down
6 changes: 6 additions & 0 deletions site/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ style = "emacs"
Mastodon = "mastodon.social/@fsfe"
Diaspora = ""

DefaultContentLanguage = "en"
defaultContentLanguageInSubdir = true
[languages]
[languages.en]
weight = 1

eighthave marked this conversation as resolved.
Show resolved Hide resolved
[menu]
[[menu.main]]
name = "Get Started"
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions site/i18n/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
table_of_contents:
other: "Table of Contents"
toggle_navigation:
other: "Toggle navigation"
warning:
other: "Warning:"
noscript_warning:
other: "Some interactive features will not work with JavaScript disabled."
tool_instructions:
other: "Tool instructions for this step"
2 changes: 1 addition & 1 deletion site/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
--> */ -}}
{{ partial "head.html" . }}
{{ partial "nav.html" . }}
{{ partial "landing.html" . }}
{{ .Content }}
{{ partial "footer.html" . }}
6 changes: 3 additions & 3 deletions site/layouts/partials/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
-->
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<noscript><div class="noscript"><strong>Warning:</strong> Some interactive features will not work with JavaScript disabled.</div></noscript>
<noscript><div class="noscript"><strong>{{ i18n "warning" }}</strong> {{ i18n "noscript_warning" }}</div></noscript>
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="sr-only">{{ i18n "toggle_navigation" }}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
Expand All @@ -35,6 +35,6 @@
</nav>
{{- $slug := "" -}}
{{- with .File -}}{{ $slug = replace (.TranslationBaseName | lower) " " "_" }}{{ end }}
{{- if not $slug -}}{{ $slug = "index" }}{{ end }}
{{- if or (not $slug) (eq $slug "_index") -}}{{ $slug = "index" }}{{ end }}
<div class="content-section-b">
<div class="container page-{{ $slug }}">
2 changes: 1 addition & 1 deletion site/layouts/shortcodes/box-tool.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="panel panel-default" id="toc">
<div class="panel-heading" role="tab" id="headingOne">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#{{ $id }}" aria-expanded="false" aria-controls="collapseOne">
<h4 class="panel-title">Tool instructions for this step</h4>
<h4 class="panel-title">{{ i18n "tool_instructions" }}</h4>
</a>
</div>
<div id="{{ $id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
Expand Down
2 changes: 1 addition & 1 deletion site/layouts/shortcodes/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="panel panel-default" id="toc">
<div class="panel-heading" role="tab" id="headingOne">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
<h4 class="panel-title">Table of Contents</h4>
<h4 class="panel-title">{{ i18n "table_of_contents" }}</h4>
</a>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
Expand Down