Skip to content

Commit

Permalink
display content translation
Browse files Browse the repository at this point in the history
if a traduction exists for the current page, display an icon, the language code and an URL
  • Loading branch information
Jibec committed Jun 2, 2020
1 parent c956915 commit c42d3d0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,8 @@ other = "Tags"
[toggleSidebar]
other = "Toggle Sidebar"

[translations]
other = "Translations"

[website]
other = "Website"
3 changes: 3 additions & 0 deletions i18n/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,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 }}
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>

0 comments on commit c42d3d0

Please sign in to comment.