summaryrefslogtreecommitdiffstats
path: root/scripts/po4a-display-pod
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 11:26:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 11:26:17 +0000
commit5df6c2aefebe3d2abcc939a88e294876d59f03ca (patch)
tree63fb332a0f21ddb91cb789c80cf64e134d373463 /scripts/po4a-display-pod
parentInitial commit. (diff)
downloadpo4a-5df6c2aefebe3d2abcc939a88e294876d59f03ca.tar.xz
po4a-5df6c2aefebe3d2abcc939a88e294876d59f03ca.zip
Adding upstream version 0.72.upstream/0.72
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/po4a-display-pod')
-rwxr-xr-xscripts/po4a-display-pod63
1 files changed, 63 insertions, 0 deletions
diff --git a/scripts/po4a-display-pod b/scripts/po4a-display-pod
new file mode 100755
index 0000000..cd07f46
--- /dev/null
+++ b/scripts/po4a-display-pod
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# po4a-display-pod shows a translated pod document, recompiling everything on the fly with po4a.
+# Translators can see the effects of their work without reinstalling everything.
+#
+
+MASTER=""
+NAME=""
+SECTION=""
+PO=""
+OPTIONS=""
+
+usage () {
+ echo "Usage : $(basename $0) -m POD_FILE -p PO_FILE [-o PO4A_OPT]"
+}
+
+while getopts m:p:o:h option; do
+ case $option in
+ m)
+ MASTER=$OPTARG
+ ;;
+ p)
+ PO=$OPTARG
+ ;;
+ o)
+ OPTIONS="$OPTIONS $OPTARG"
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ [?])
+ usage 1>&2
+ exit 1
+ ;;
+ esac
+done
+
+if [ -z $PO ] || [ -z $MASTER ]; then
+ usage
+ exit 1
+fi
+
+if [ ! -f $PO ]; then
+ echo "Error: unable to find the file $PO."
+ usage
+ exit 1
+fi
+
+if [ ! -f $MASTER ]; then
+ echo "Error: unable to find the file $MASTER."
+ usage
+ exit 1
+fi
+
+# Can fail to retrieve the expected result with various files...
+#NAME=$(basename $MASTER .pod | sed -e 's/\..//')
+#SECTION=$(basename $MASTER .pod | sed -e 's/.*\.//')
+
+po4a-translate -f pod -m $MASTER -p $PO -L UTF-8 -k 0 $OPTIONS \
+ | pod2man -r '' -c TRANSLATED -n $MASTER --utf8 \
+ | man -l -
+