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

add language widget #279

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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 i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ other = "Go Home..."
[lastUpdated]
other = "Last updated"

[languages]
other = "Languages"

[leaveAComment]
other = "Leave a comment"

Expand Down Expand Up @@ -151,5 +154,8 @@ other = "Tags"
[toggleSidebar]
other = "Toggle Sidebar"

[translations]
other = "Translations"

[website]
other = "Website"
6 changes: 6 additions & 0 deletions i18n/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ other = "Gopher"
[goHome]
other = "Retourner à l'accueil..."

[languages]
other = "Langues"

[leaveAComment]
other = "Laisser un commentaire"

Expand Down Expand Up @@ -148,5 +151,8 @@ other = "Étiquettes"
[toggleSidebar]
other = "Déplier la barre latérale"

[translations]
other = "Traductions"

[website]
other = "Site web"
1 change: 1 addition & 0 deletions layouts/partials/entry/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
{{ partial "entry/meta/posted-on" . }}
{{ partial "entry/meta/author" . }}
{{ partial "entry/meta/reading-time" . }}
{{ partial "entry/meta/translations" . }}
</div>
{{ end }}
7 changes: 7 additions & 0 deletions layouts/partials/entry/meta/translations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- partial "svg/icons" "translations" -}}
{{ if .IsTranslated }}
<span class='screen-reader-text'> {{ i18n "translations" }} </span>
{{ range .Translations }}
<a href="{{ .Permalink }}">{{ .Lang }}</a>
{{ end }}
{{ end }}
1 change: 1 addition & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h1 class='site-title title'>{{ .Site.Title }}</h1>
<p class='desc site-desc'>{{ .Site.Params.info.description }}</p>
</div>
</div>
{{- partial "header/extra" . -}}
</header>

<main id='content'>
5 changes: 5 additions & 0 deletions layouts/partials/header/extra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{/*
If you need to add content to your page header, override this template in your
blog by creating a file named `/layout/partials/header/extra.html`. This way you
don't have to edit the theme itself.
*/}}
2 changes: 2 additions & 0 deletions layouts/partials/svg/icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@
{{ else if eq "search" . }}
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
{{ else if eq "translations" . }}
<path stroke-width='0.5' fill="#72777d" d="M13 19l.8-3h5.3l.9 3h2.2L18 6h-3l-4.2 13H13zm3.5-11l2 6h-4l2-6zM5 4l.938 1.906H1V8h1.594C3.194 9.8 4 11.206 5 12.406c-1.1.7-4.313 1.781-4.313 1.781L2 16s3.487-1.387 4.688-2.188c1 .7 2.319 1.188 3.719 1.688l.594-2c-1-.3-1.988-.688-2.688-1.188 1.1-1.1 1.9-2.506 2.5-4.406h2.188l.5-2H7.938L7 4H5zm-.188 4h3.781c-.4 1.3-.906 2-1.906 3-1.1-1-1.475-1.7-1.875-3z"/>
{{ end }}
</svg>
12 changes: 12 additions & 0 deletions layouts/partials/widgets/languages.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<section class='widget widget-languages sep-after'>
<header>
<h4 class='title widget-title'>
{{ i18n "languages" }}
</h4>
</header>

{{ range $.Site.Home.AllTranslations }}
<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
{{ end }}

</section>