summaryrefslogtreecommitdiffstats
path: root/po/update_po_files.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
commit35a96bde514a8897f6f0fcc41c5833bf63df2e2a (patch)
tree657d15a03cc46bd099fc2c6546a7a4ad43815d9f /po/update_po_files.sh
parentInitial commit. (diff)
downloadinkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.tar.xz
inkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.zip
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'po/update_po_files.sh')
-rwxr-xr-xpo/update_po_files.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/po/update_po_files.sh b/po/update_po_files.sh
new file mode 100755
index 0000000..b50b05e
--- /dev/null
+++ b/po/update_po_files.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Run before 'make inkscape_pot' from the copiling
+# directory with cmake to generate inkscape.pot file.
+# Updates PO files from the current POT file
+# Please run this program from the po/ directory
+# Existing po.old files will be overwritten
+
+if [ "$?" -eq "0" ]; then
+ POT_FILENAME="`ls -1rt *.pot 2>/dev/null|tail -1 2>/dev/null`"
+ if [ ! -r "$POT_FILENAME" ]; then
+ echo "Could not create POT file. Exiting."
+ exit
+ fi
+else
+ echo "Could not create POT file (intltool-update not found). Exiting."
+ exit
+fi
+
+PO_FILE_COUNT=0
+
+find . -noleaf -type f -name "*.po"|sort|\
+(
+while read FILENAME; do
+ PO_FILE_COUNT=`expr $PO_FILE_COUNT + 1`
+ mv -f "$FILENAME" "$FILENAME".old # do not ask questions, because the answers would come from the pipe
+ if [ "$?" -eq "0" ]; then
+ echo "$FILENAME"
+ msgmerge "$FILENAME".old "$POT_FILENAME" > "$FILENAME"
+ if [ "$?" -ne "0" ]; then
+ echo "Could not merge \"$FILENAME.old\"."
+ else
+ rm "$FILENAME".old
+ msgfmt -c "$FILENAME"
+ fi
+ else
+ echo "Could not rename \"$FILENAME\". File skipped."
+ fi
+done
+
+echo; echo "Total number of PO files: $PO_FILE_COUNT"
+)
+
+echo