More i18n improvements

This commit is contained in:
Joshua Goins 2024-10-13 20:32:26 -04:00
parent bb2146725f
commit 981ad20054
9 changed files with 43 additions and 34 deletions

View file

@ -1,5 +1,5 @@
--- ---
title: "Home" title: "トップ"
--- ---
進行中... 進行中...

View file

@ -54,6 +54,7 @@
"height" (index $sizes.full $basename).height "height" (index $sizes.full $basename).height
"thumb_width" (index $sizes.thumb $basename).width "thumb_width" (index $sizes.thumb $basename).width
"thumb_height" (index $sizes.thumb $basename).height "thumb_height" (index $sizes.thumb $basename).height
"filename" $basename
}} }}
{{ $path := $basename }} {{ $path := $basename }}

View file

@ -30,6 +30,28 @@
{{ $title = . }} {{ $title = . }}
{{ end }} {{ end }}
{{ $path := $basename }}
{{ if eq $year "guest" }}
{{ $path = (printf "guest/%s" $basename) }}
{{ end }}
{{ $languages := $data.languages }}
{{ range $key, $val := $languages }}
{{/* This is needed because art is placed under a different URL based on permalinks, and those aren't localized. */}}
{{ $month := "1" }}
{{ $year := "1" }}
{{ if $data.date }}
{{ $split := split $data.date "-" }}
{{ $month = index $split 1 }}
{{ $year = index $split 0 }}
{{ end }}
{{ $filename := $basename }}
{{ if $val.filename }}
{{ $filename = $val.filename }}
{{ end }}
{{ $params := dict {{ $params := dict
"slug" $basename "slug" $basename
"alt_text" $data.alt_text "alt_text" $data.alt_text
@ -54,25 +76,9 @@
"height" (index $sizes.full $basename).height "height" (index $sizes.full $basename).height
"thumb_width" (index $sizes.thumb $basename).width "thumb_width" (index $sizes.thumb $basename).width
"thumb_height" (index $sizes.thumb $basename).height "thumb_height" (index $sizes.thumb $basename).height
"filename" $filename
}} }}
{{ $path := $basename }}
{{ if eq $year "guest" }}
{{ $path = (printf "guest/%s" $basename) }}
{{ end }}
{{ $languages := $data.languages }}
{{ range $key, $val := $languages }}
{{/* This is needed because art is placed under a different URL based on permalinks, and those aren't localized. */}}
{{ $month := "1" }}
{{ $year := "1" }}
{{ if $data.date }}
{{ $split := split $data.date "-" }}
{{ $month = index $split 1 }}
{{ $year = index $split 0 }}
{{ end }}
{{ $langPage := dict {{ $langPage := dict
"slug" $basename "slug" $basename
"content" $content "content" $content
@ -83,7 +89,6 @@
"params" $params "params" $params
"layout" "art-detail" "layout" "art-detail"
}} }}
{{ warnf $langPage.path }}
{{ $.AddPage $langPage }} {{ $.AddPage $langPage }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -11,7 +11,7 @@
"title": "Another Thursday", "title": "Another Thursday",
"languages": { "languages": {
"jp": { "jp": {
"title": "めるめ外出!" "title": "の木曜日"
} }
} }
} }

View file

@ -15,7 +15,8 @@
"title": "Viera ID Check", "title": "Viera ID Check",
"languages": { "languages": {
"jp": { "jp": {
"title": "ヴィエラそ して 彼女 身分証明書" "title": "ヴィエラそ して 彼女 身分証明書",
"filename": "idcheck-jp"
} }
} }
} }

View file

@ -3,3 +3,4 @@ social_media: Accounts
date: Date date: Date
characters: Characters characters: Characters
program: Program program: Program
tags: Tags

View file

@ -3,3 +3,4 @@ social_media: ソーシャルメディア
date: date:
characters: 作中人物 characters: 作中人物
program: ソフトウェア program: ソフトウェア
tags: タグ

View file

@ -6,8 +6,8 @@
<hr> <hr>
{{ if (and (not $.Params.animation) (and (not (in .File.Dir "art/guest")) (and (not $.Params.threed) (not $.Params.comic) )) ) }} {{ if (and (not $.Params.animation) (and (not (in .File.Dir "art/guest")) (and (not $.Params.threed) (not $.Params.comic) )) ) }}
{{ $full := printf "%s/art/%s.avif" $.Site.Params.image_host $.Params.slug }} {{ $full := printf "%s/art/%s.avif" $.Site.Params.image_host $.Params.filename }}
{{ $jpeg := printf "%s/art/%s.jpg" $.Site.Params.image_host $.Params.slug }} {{ $jpeg := printf "%s/art/%s.jpg" $.Site.Params.image_host $.Params.filename }}
<picture> <picture>
<source srcset="{{ $full }}" type="image/avif" width="{{ $.Params.width }}" height="{{ $.Params.height }}"/> <source srcset="{{ $full }}" type="image/avif" width="{{ $.Params.width }}" height="{{ $.Params.height }}"/>

View file

@ -1,7 +1,7 @@
{{/* Partial used to display a thumbnail of an artwork. */}} {{/* Partial used to display a thumbnail of an artwork. */}}
{{ $full := printf "%s/thumb/%s.avif" $.Site.Params.image_host .Params.slug }} {{ $full := printf "%s/thumb/%s.avif" $.Site.Params.image_host .Params.filename }}
{{ $jpeg := printf "%s/thumb/%s.jpg" $.Site.Params.image_host .Params.slug }} {{ $jpeg := printf "%s/thumb/%s.jpg" $.Site.Params.image_host .Params.filename }}
<a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .RelPermalink }}"> <a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .RelPermalink }}">