aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/conf
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-10 14:12:12 -0300
committerEuAndreh <eu@euandre.org>2023-04-10 14:12:37 -0300
commitfc794694b1d83d6856b36ea08df69c2a0861d030 (patch)
tree752cb386042281cfcc72836623af733c3253bff2 /v2/src/bin/conf
parentv2: Support translated alternates in <nav> (diff)
downloadeuandre.org-fc794694b1d83d6856b36ea08df69c2a0861d030.tar.gz
euandre.org-fc794694b1d83d6856b36ea08df69c2a0861d030.tar.xz
v2: <link /> to translated version in <head />
Diffstat (limited to '')
-rwxr-xr-xv2/src/bin/conf12
1 files changed, 8 insertions, 4 deletions
diff --git a/v2/src/bin/conf b/v2/src/bin/conf
index e4dba61..3b56dbd 100755
--- a/v2/src/bin/conf
+++ b/v2/src/bin/conf
@@ -155,17 +155,21 @@ if [ -z "${title:-}" ]; then
fi
if [ -r "$FILENAME".i18n ]; then
- translations="$(cat <<-EOF
+ translations_head="$(awk -F: -v lang="$lang" '$1 != lang{
+ printf " <link rel=\"alternate\" type=\"text/html\" href=\"%s\" hreflang=\"%s\" />\n",
+ $3, $1
+ }' "$FILENAME".i18n)"
+ translations_body="$(cat <<-EOF
<ul class="translation-list">
$(awk -F: '{
- "url-for " $2 | getline url
printf " <li><a href=\"%s\">%s</a></li>\n",
- url, $1
+ $3, $1
}' "$FILENAME".i18n)
</ul>
EOF
)"
- printf 'export translations_html="%s"\n' "$(shesc "$translations")"
+ printf 'export translations_head_html="%s"\n' "$(shesc "$translations_head")"
+ printf 'export translations_body_html="%s"\n' "$(shesc "$translations_body")"
fi
if [ -n "${date:-}" ]; then