mirror of
https://salsa.debian.org/debian/debian-reference.git
synced 2026-01-16 23:14:19 +00:00
30 lines
933 B
Bash
Executable file
30 lines
933 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# interwiki LANGUAGE [MODE]
|
|
#
|
|
# LANGUAGE = ja, fr, es, ...
|
|
# MODE = PRINT, NO
|
|
# PRINT means to print English URL if translation does not exist.
|
|
# NO means not to print any URL if translation does not exist.
|
|
#
|
|
LANGAGE=$1
|
|
MODE=$2
|
|
while read -r X; do
|
|
# normal translation
|
|
Y=$(wget -O - "$X" 2>/dev/null | sed -n "s/^.*interwiki-${LANGAGE}\"><a href=\"\(.*\)\".*$/\1/p" | sed 's/%/\\x/')
|
|
# just translate funky UTF-8 URLs
|
|
#Y=$(wget -O - $X 2>/dev/null |sed -n "s/^.*interwiki-${LANGAGE}\"><a href=\"\(.*\)\".*$/\1/p" | sed -n 's/%/\\x/g')
|
|
if [ -n "$Y" ]; then
|
|
echo "# ----------------- translated"
|
|
echo "msgid \"$X\""
|
|
/usr/bin/printf '%b\n' "msgstr \"$Y\""
|
|
echo ""
|
|
echo "--- $X: translated." 1>&2
|
|
elif [ "$MODE" = "PRINT" ]; then
|
|
echo "# ################# no-translaton"
|
|
echo "msgid \"$X\""
|
|
echo "msgstr \"$X\""
|
|
echo ""
|
|
echo "### $X: no-translaton." 1>&2
|
|
fi
|
|
done
|