Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
i18n: render dates with a per-language layout The human-readable date layout now comes from the language's i18n file instead of being hardcoded in time.html Also, fix missing paddings for language options + fix footnotes divider line
assets/style.scss | 6 +++--- i18n/en.toml | 15 ++++++++++----- i18n/pt-br.toml | 17 +++++++++++------ layouts/_partials/time.html | 5 ++++-
diff --git a/assets/style.scss b/assets/style.scss
index d5310b3ba491fef5488c7efe5aa33fcfb2f3a8ed..2e5c5f215f3727655413ec5be1a69bb4fd87de36 100644
--- a/assets/style.scss
+++ b/assets/style.scss
@@ -210,7 +210,7 @@ .translations ul {
display: flex;
flex-wrap: wrap;
gap: 1rem;
- margin: 0;
+ margin: 0 0 2em 0;
padding: 0;
list-style: none;
}
@@ -583,10 +583,10 @@ color: var(--text-muted);
}
.post-body .footnotes hr {
- width: 4rem;
margin: 0 0 1.25rem;
+ display: none;
border: 0;
- border-top: 2px solid var(--text-primary);
+ border-top: 1px solid var(--text-muted);
}
.post-body .footnotes ol {
diff --git a/i18n/en.toml b/i18n/en.toml
index 3ec1f9724f4aaabf238fc70c5961bb12468615db..5e0f13a12092461fbfd9c515abaeafd019807963 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -23,7 +23,11 @@ other = "Toggle color scheme"
[logTitle]
other = "Field Notes & Observations"
[byline]
-other = "By Pedro Lucas Porcellis -- a brazilian programmer. When I'm not working on FOSS, gardening, baking bread, I'll jot down something here."
+other = """
+By Pedro Lucas Porcellis — a brazilian programmer. When I'm not working on
+FOSS, gardening or baking bread, I'll jot down something here.
+"""
+
[readDispatch]
other = "Read dispatch"
[filedUnder]
@@ -36,6 +40,9 @@ [postLabel]
other = "POST"
[minutes]
other = "min"
+[dateFormat]
+other = "2006-01-02"
+
[footer]
other = """
Comments, questions? Send an email to \
@@ -53,8 +60,6 @@
"""
[bio]
other = """
-
- I write code to pay my bills. I do random stuff because I have too much
- chemicals on my brain. Sometimes I spit out some words on this blog.
-
+By Pedro Lucas Porcellis — a brazilian programmer. When I'm not working on
+FOSS, gardening or baking bread, I'll jot down something here.
"""
diff --git a/i18n/pt-br.toml b/i18n/pt-br.toml
index 916a3d0d0cacb49c0c80b347e7c1e7f9c3ef0433..78f381a003f98254bba6f80d6d1bb4f44cba2cf0 100644
--- a/i18n/pt-br.toml
+++ b/i18n/pt-br.toml
@@ -23,7 +23,11 @@ other = "Alternar esquema de cores"
[logTitle]
other = "Notas de Campo & Observações"
[byline]
-other = "Por Pedro Lucas Porcellis -- um programador brasileiro. Quando não estou trabalhando em software livre, cuidando do jardim ou fazendo pão, anoto alguma coisa por aqui."
+other = """
+Por Pedro Lucas Porcellis — um programador brasileiro. Quando não estou
+trabalhando em software livre, cuidando da minha horta ou fazendo pão, devaneio alguma
+coisa por aqui.
+"""
[readDispatch]
other = "Ler o registro"
[filedUnder]
@@ -36,6 +40,9 @@ [postLabel]
other = "POST"
[minutes]
other = "min"
+[dateFormat]
+other = "02/01/2006"
+
[footer]
other = """
Comentários, dúvidas? Envie um email para \
@@ -53,9 +60,7 @@
"""
[bio]
other = """
-
- Escrevo código para pagar as contas. Eu faço coisas aleatórias
- porque tenho muitas substâncias químicas no meu cérebro.
- Às vezes eu cuspo umas palavras nesse blog.
-
+Por Pedro Lucas Porcellis — um programador brasileiro. Quando não estou
+trabalhando em software livre, cuidando do jardim ou fazendo pão, anoto alguma
+coisa por aqui.
"""
diff --git a/layouts/_partials/time.html b/layouts/_partials/time.html
index 798b7473c2b57361a45719ce574ef588b3101f70..594c93a31624272fe7a98b28aaefbde6944c8d82 100644
--- a/layouts/_partials/time.html
+++ b/layouts/_partials/time.html
@@ -1 +1,4 @@
-<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTMLAttr }}">{{ .Date | time.Format "2006-01-02" }}</time>
+{{- /* Human-readable date uses the layout declared by the current language in
+ i18n (en: ISO, pt-br: DD/MM/YYYY); the datetime attribute stays ISO 8601
+ so machines always get an unambiguous value. */ -}}
+<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTMLAttr }}">{{ .Date | time.Format (i18n "dateFormat") }}</time>