summaryrefslogtreecommitdiff
path: root/po4a/list-documents
diff options
context:
space:
mode:
Diffstat (limited to 'po4a/list-documents')
-rwxr-xr-xpo4a/list-documents45
1 files changed, 45 insertions, 0 deletions
diff --git a/po4a/list-documents b/po4a/list-documents
new file mode 100755
index 0000000..ca17ec5
--- /dev/null
+++ b/po4a/list-documents
@@ -0,0 +1,45 @@
+#!/bin/bash
+set -e
+set -o pipefail
+
+fail () { "echo >&2 $0: $*"; exit 1; }
+
+langs=( $( { ! test -f *.po || ls *.po; } \
+ | sed 's#\.po$##; s#.*\.##' \
+ | LC_COLLATE=C.UTF-8 sort -u) )
+
+cat <<END
+[po4a_langs] $langs
+# ^ add your language here (separate with spaces)
+
+# Do not edit the rest of this file. It is automatically maintained.
+[options] opt:"-MUTF-8" opt:"-k50"
+[po4a_paths] \$master.pot \$lang:\$master.\$lang.po
+END
+
+for manpage in $(cd .. && env -u MAKELEVEL -u MAKEFLAGS make list-manpages); do
+ manpage_done=false
+
+ try_manpage () {
+ if $manpage_done; then return; fi
+
+ type=$1; ext=$2
+
+ src=../$manpage$ext
+ if ! [ -f $src ]; then return; fi
+
+ section=${manpage##*.}
+ base=${manpage%.*}
+ page=$base.$section
+
+ cat <<END
+[type: $type] $src \$lang:translated/man/\$lang/man$section/$page$ext master:file=${base}_${section}
+END
+
+ manpage_done=true
+ }
+
+ try_manpage pod .pod
+ try_manpage man ''
+ $manpage_done || fail "no source for $manpage"
+done