aboutsummaryrefslogtreecommitdiffstats
path: root/tools/po-compile.sh
diff options
context:
space:
mode:
authorSARL ENR-68 <david@david.david>2014-09-08 22:12:23 +0200
committerSARL ENR-68 <david@david.david>2014-09-08 22:12:23 +0200
commit91f5e36949b12d98b62e916657aafbd547973ff5 (patch)
tree8702a0543a6200567825cd2a5c5d6c8ca9150307 /tools/po-compile.sh
parent1282fb3fc4fcda3a9bea78802b5c2bff3385fe6c (diff)
downloadMageiaSync-91f5e36949b12d98b62e916657aafbd547973ff5.tar
MageiaSync-91f5e36949b12d98b62e916657aafbd547973ff5.tar.gz
MageiaSync-91f5e36949b12d98b62e916657aafbd547973ff5.tar.bz2
MageiaSync-91f5e36949b12d98b62e916657aafbd547973ff5.tar.xz
MageiaSync-91f5e36949b12d98b62e916657aafbd547973ff5.zip
initial commit from david.david
- add a spec file - add translations tools - add a setup.py file for build and install - add a desktop file and a desktop file in - add an empty README.rst - add a po folder for future translation files - replace lib folder by mageiasync folder
Diffstat (limited to 'tools/po-compile.sh')
-rw-r--r--tools/po-compile.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/po-compile.sh b/tools/po-compile.sh
new file mode 100644
index 0000000..a29d8cb
--- /dev/null
+++ b/tools/po-compile.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+if test "$1" = "-h" -o "$1" = "--help"; then
+ echo "Use: $0 [<language>]"
+ echo "Run without arguments to compile all translation files."
+ exit 0
+fi
+
+cd "$(readlink -f "$(dirname "$0")/..")"
+
+update_mo(){
+ echo $1
+ language="$(basename "$1")"
+ language="${language%.po}"
+ target="$PWD/share/locale/$language/LC_MESSAGES/isodumper.mo"
+ echo $target
+ /bin/mkdir --parents "$(dirname "$target")"
+ /usr/bin/msgfmt \
+ --check \
+ --output-file="$target" \
+ "$1"
+}
+
+if test "$1"; then
+ for l in $(find "$PWD/po" -type f -name "$1.po"); do
+ echo $l
+ update_mo "$l"
+ done
+else
+ for l in $(find "$PWD/po" -type f -name '*.po'); do
+ update_mo "$l"
+ done
+fi \ No newline at end of file