aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorpapoteur-mga <yves.brungard_git@gadz.org>2013-09-26 20:49:51 +0200
committerpapoteur-mga <yves.brungard_git@gadz.org>2013-09-26 20:49:51 +0200
commit2ece2daa063a57a523f420a656cc601f352ed64f (patch)
tree44e3c2e3b37199f06353f12c42af479c89b06afb /tools
parent25afb8ca22016f2eac31f38236ec1ffc081bd9aa (diff)
parentdc1e3e443117f8643906cdb8792404377a809624 (diff)
downloadisodumper-2ece2daa063a57a523f420a656cc601f352ed64f.tar
isodumper-2ece2daa063a57a523f420a656cc601f352ed64f.tar.gz
isodumper-2ece2daa063a57a523f420a656cc601f352ed64f.tar.bz2
isodumper-2ece2daa063a57a523f420a656cc601f352ed64f.tar.xz
isodumper-2ece2daa063a57a523f420a656cc601f352ed64f.zip
Merge branch 'master' of https://github.com/papoteur-mga/isodumper
get uk.po
Diffstat (limited to 'tools')
-rw-r--r--tools/po-compile.sh17
-rwxr-xr-xtools/po-update.sh67
2 files changed, 84 insertions, 0 deletions
diff --git a/tools/po-compile.sh b/tools/po-compile.sh
new file mode 100644
index 0000000..2b4d364
--- /dev/null
+++ b/tools/po-compile.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+cd "$(readlink -f "$(dirname "$0")/..")"
+
+find "$PWD/po" -type f -name '*.po' | \
+while read po_file; do
+ language="$(basename "$po_file")"
+ language="${language%.po}"
+ target="$PWD/po/$language/LC_MESSAGES/isodumper.mo"
+ /bin/mkdir --parents "$(dirname "$target")"
+ /usr/bin/msgfmt \
+ --check \
+ --output-file="$target" \
+ "$po_file"
+done
diff --git a/tools/po-update.sh b/tools/po-update.sh
new file mode 100755
index 0000000..27c2606
--- /dev/null
+++ b/tools/po-update.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+if test -z "$1"; then
+ echo "Use: $0 <locale>"
+ exit 2
+fi
+LL_CC="$1"
+shift
+
+set -e
+
+cd "$(readlink -f "$(dirname "$0")/..")"
+
+VERSION=(0.1)
+DOMAIN=(isodumper)
+
+SOURCE_FILES=$(/bin/mktemp --tmpdir $DOMAIN-po-update-XXXXXX)
+find "lib" -name '*.py' >"$SOURCE_FILES"
+
+POT_DIR="$PWD/po"
+test -d "$POT_DIR"
+
+POT_FILE="$POT_DIR/$DOMAIN.pot"
+
+/usr/bin/xgettext \
+ --package-name "$DOMAIN" \
+ --package-version "$VERSION" \
+ --default-domain="$L_NAME" \
+ --language=Python --from-code=UTF-8 --files-from="$SOURCE_FILES" \
+ --no-escape --indent --add-location --sort-by-file \
+ --add-comments=I18N \
+ --output="$POT_FILE"
+
+/bin/sed --in-place --expression="s/charset=CHARSET/charset=UTF-8/" "$POT_FILE"
+
+PO_FILE="$POT_DIR/$LL_CC.po"
+
+test -r "$PO_FILE" || /usr/bin/msginit \
+ --no-translator --locale="$LL_CC" \
+ --input="$POT_FILE" \
+ --output-file="$PO_FILE"
+
+#unfmt() {
+# local SOURCE="/usr/share/locale/$LL_CC/LC_MESSAGES/$1.mo"
+# if [ ! -f $SOURCE ]
+# then
+# local SOURCE="/usr/share/locale-langpack/$LL_CC/LC_MESSAGES/$1.mo"
+# fi
+# local TARGET="$(mktemp --tmpdir $1-$LL_CC-XXXXXX.po)"
+# /usr/bin/msgunfmt \
+# --no-escape --indent \
+# --output-file="$TARGET" \
+# "$SOURCE"
+# echo "$TARGET"
+#}
+
+#/usr/bin/msgmerge \
+# --update --no-fuzzy-matching \
+# --no-escape --indent --add-location --sort-by-file \
+# --lang="$LL_CC" \
+# --compendium="$(unfmt gtk30)" \
+# --compendium="$(unfmt gtk30-properties)" \
+# "$PO_FILE" "$POT_FILE"
+
+# /bin/sed --in-place --expression="s/Language: \\\\n/Language: $L_NAME\\\\n/" "$PO_FILE"
+
+echo "Language file is $PO_FILE"