diff options
author | EuAndreh <eu@euandre.org> | 2021-06-19 17:18:14 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-06-19 17:18:14 -0300 |
commit | 4441f2f6a9d33e58708c143e8397d69a75610421 (patch) | |
tree | 6a9e687db018137cf4effb915d876a538774181a /aux/workflow | |
parent | aux/ci/report.sh: Don't override signatures notes ref (diff) | |
download | remembering-4441f2f6a9d33e58708c143e8397d69a75610421.tar.gz remembering-4441f2f6a9d33e58708c143e8397d69a75610421.tar.xz |
Setup base i18n infrastructure
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--] | aux/workflow/assert-manpages.sh | 136 | ||||
-rwxr-xr-x | aux/workflow/manpages.sh | 55 |
2 files changed, 188 insertions, 3 deletions
diff --git a/aux/workflow/assert-manpages.sh b/aux/workflow/assert-manpages.sh index f265ab4..7254d60 100644..100755 --- a/aux/workflow/assert-manpages.sh +++ b/aux/workflow/assert-manpages.sh @@ -18,8 +18,9 @@ while getopts 'i' flag; do esac done -EXPECTED="$(mktemp)" -cat <<EOF >> "$EXPECTED" + +EXPECTED_EN="$(mktemp)" +cat <<EOF | sed 's|-|\\-|g' >> "$EXPECTED_EN" .SH AUTHORS @@ -37,7 +38,8 @@ Report bugs to the .MT ~euandreh/$MAILING_LIST@lists.sr.ht mailing list .ME . -Use the subject "\fC[$PROJECT] BUG or TASK: <description>\fR". +Use the subject "\f(CR[$PROJECT] BUG or TASK: +<description>\fR". .IP \(bu Browse bugs .UR https://$TLD/$PROJECT/TODOs.html @@ -53,12 +55,140 @@ Comments and discussions .UE . EOF +EXPECTED_PT="$(mktemp)" +cat <<EOF | sed 's|-|\\-|g' >> "$EXPECTED_PT" + + +.SH AUTORES + +.MT eu@euandre.org +EuAndreh +.ME +e colaboradores. + + +.SH BUGS + +.IP \(bu +Relate bugs na +.MT ~euandreh/$MAILING_LIST@lists.sr.ht +lista de discussão +.ME . +Use o assunto "\f(CR[$PROJECT] BUG ou TASK: +<descrição>\fR". +.IP \(bu +Veja os bugs +.UR https://$TLD/$PROJECT/TODOs.html +online +.UE . +.IP \(bu +.UR https://$TLD/$PROJECT/ +Página inicial +.UE . +.IP \(bu +.UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D +Comentários e discussões +.UE . +EOF + +EXPECTED_FR="$(mktemp)" +cat <<EOF | sed 's|-|\\-|g' >> "$EXPECTED_FR" + + +.SH AUTEURS + +.MT eu@euandre.org +EuAndreh +.ME +et les contributeurs. + + +.SH BUGS + +.IP \(bu +Soumettre un bogue dans la +.MT ~euandreh/$MAILING_LIST@lists.sr.ht +liste +de diffusion +.ME . +Utilise le sujèt "\f(CR[$PROJECT] BUG ou TASK: +<description>\fR". +.IP \(bu +Parcourir les bogues +.UR https://$TLD/$PROJECT/TODOs.html +en +ligne +.UE . +.IP \(bu +.UR https://$TLD/$PROJECT/ +Page d'accueil +.UE . +.IP \(bu +.UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D +Commentaires et discussions +.UE . +EOF + +EXPECTED_EO="$(mktemp)" +cat <<EOF | sed 's|-|\\-|g' >> "$EXPECTED_EO" + + +.SH AŬTOROJ + +.MT eu@euandre.org +EuAndreh +.ME +kaj la kontribuuloj. + + +.SH MISFUNKCIOJ + +.IP \(bu +Raportu misfunkcioj al la +.MT ~euandreh/$MAILING_LIST@lists.sr.ht +dissendolisto +.ME . +Uzu la subjekton "\f(CR[$PROJECT] BUG aŭ TASK: +<priskribo>\fR". +.IP \(bu +Foliumu misfunkcioj +.UR https://$TLD/$PROJECT/TODOs.html +rete +.UE . +.IP \(bu +.UR https://$TLD/$PROJECT/ +Ĉefpaĝo +.UE . +.IP \(bu +.UR https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D +Komentoj kaj diskutoj +.UE . +EOF + + # shellcheck disable=2044 for f in $(find doc -type f -name '*.[0-9]'); do LINES="$(wc -l "$f" | cut -d\ -f1)" if [ "$LINES" = 1 ] && grep -Eq '^\.so man.+$' "$f"; then continue fi + + lang="$(echo "$f" | cut -d. -f2)" + case "$lang" in + pt) + EXPECTED="$EXPECTED_PT" + ;; + fr) + EXPECTED="$EXPECTED_FR" + ;; + eo) + EXPECTED="$EXPECTED_EO" + ;; + *) + EXPECTED="$EXPECTED_EN" + ;; + esac + if ! tail -n "$(wc -l < "$EXPECTED")" "$f" | diff - "$EXPECTED"; then echo "Missing metadata at the end of \"$f\" file" if [ "$IN_PLACE" = true ]; then diff --git a/aux/workflow/manpages.sh b/aux/workflow/manpages.sh new file mode 100755 index 0000000..e4ea8f2 --- /dev/null +++ b/aux/workflow/manpages.sh @@ -0,0 +1,55 @@ +#!/bin/sh +set -eu + +LANGS="$1" +OP="$2" +PREFIX="${3:-}" + +if [ "$OP" = '--update' ]; then + for f in doc/*.en.[1-9]; do + for lang in $LANGS; do + to="$(echo "$f" | sed "s|\.en\.|.$lang.|")" + po4a-updatepo -f man -m "$f" -p "doc/$lang.po" + printf 'Translating %s...\n' "$to" >&2 + OUT="$(po4a-translate -f man -m "$f" -p "doc/$lang.po" -l "$to" -k 0 -v 2>&1)" + echo "$OUT" >&2 + if ! echo "$OUT" | grep -qF ' is 100% translated ('; then + printf "\n WARNING!\n Missing translations for %s\n\n" "$to" >&2 + fi + done + done +else + shift 4 ||: # remove up to '--' + for f in doc/*.en.[1-9]; do + n="${f##*.}" + fileto_name="$(basename "${f%.en.$n}").$n" + for lang in $LANGS en; do + filefrom_name="${f%.en.$n}.$lang.$n" + mandir_name="$PREFIX/$lang/man$n" + htmldir_name="public/$lang/" + case "$OP" in + --install) + mkdir -p "$mandir_name" + # shellcheck disable=2068 + $@ < "$filefrom_name" > "$mandir_name/$fileto_name" + mkdir -p "$PREFIX/man$n" + ln -fs "../en/man$n/$fileto_name" "$PREFIX/man$n/$fileto_name" + ;; + --uninstall) + rm -f \ + "$PREFIX/$lang/man$n/$fileto_name" \ + "$PREFIX/man$n/$fileto_name" + ;; + --html) + mkdir -p "$htmldir_name" + # shellcheck disable=2068 + $@ < "$filefrom_name" | pandoc -s -r man -w html > "public/$lang/$fileto_name.html" + ;; + *) + echo "Unsupported operation: $OP" + exit 2 + ;; + esac + done + done +fi |