summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrike Uhlig <u@451f.org>2018-06-12 14:10:54 +0200
committerUlrike Uhlig <u@451f.org>2018-06-12 14:10:54 +0200
commitc78aadcf853b91b67ebbd5b8993ed0c78374a727 (patch)
tree24901bf8d78393af931ac2b0c351a6f7b0060df4
parent005a831336345b66649461dd326cc38f7bed9ef4 (diff)
Add more comments
-rwxr-xr-xwiki/src/contribute/l10n_tricks/unify_po-headers.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/wiki/src/contribute/l10n_tricks/unify_po-headers.sh b/wiki/src/contribute/l10n_tricks/unify_po-headers.sh
index 1162cb3..4b0bcb0 100755
--- a/wiki/src/contribute/l10n_tricks/unify_po-headers.sh
+++ b/wiki/src/contribute/l10n_tricks/unify_po-headers.sh
@@ -2,6 +2,7 @@
# -*- mode: sh; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=4 sts=4 expandtab autoindent:
# This file unifies PO headers and rewraps PO files to 79 chars.
+# Usage: ./unify-po-headers [2-letter language code]
set -e
@@ -22,13 +23,13 @@ find -wholename ./tmp -prune -o \( -iname "$FILE_GLOB" -print0 \) \
| xargs -0 --max-procs="$CPUS" --max-args=64 -I {} \
sh -c 'FNAME="{}"; BASENAME="${FNAME#*/}"; BASENAME1="${BASENAME%.*}"; LANG="${BASENAME1##*.}"; sed -i -e "s/^\"Language: .*$/\"Language: ${LANG}\\\n\"/" {}'
-# unfortunately the syntax of po headers can expand to different lines,
-# that's why we need to treat sed to parse correctly multilines.
-# the way we use is to merge all lines together (1h;1!H) and search/replace in the whole string
-# another option would be to call python/perl to get a reex that is easier to read.
-# python: '^.*<Key>:(.*\n)*.*\\n.*$'
+# Unfortunately the syntax of po headers can expand to different lines,
+# that's why we need to treat sed to parse multilines correctly.
+# The way we do that is to merge all lines together (1h;1!H) and search/replace the whole string.
+# >nother option would be to call python/perl to get a reex that is easier to read.
+# Python: '^.*<Key>:(.*\n)*.*\\n.*$'
-# Unify Project-Id-Version
+# Unify, i.e. empty Project-Id-Version
find -wholename ./tmp -prune -o \( -iname "$FILE_GLOB" -print0 \) \
| xargs -0 --max-procs="$CPUS" --max-args=64 -I {} \
sed -i -n '1h;1!H;${;g;s/[^\n]*Project-Id-Version: [^\\]*\\n[^\n]*/"Project-Id-Version: \\n"/g;p;}' {}