aboutsummaryrefslogtreecommitdiff
path: root/update-pot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'update-pot.sh')
-rwxr-xr-xupdate-pot.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/update-pot.sh b/update-pot.sh
index 43a8d06..01e9da0 100755
--- a/update-pot.sh
+++ b/update-pot.sh
@@ -16,10 +16,30 @@
GETTEXT_DOMAIN=$(cat CMakeLists.txt | grep 'set.*(.*GETTEXT_PACKAGE' | sed -r -e 's/.*\"([^"]+)\"\)/\1/')
+# Rename function calls 'T_([...])' to 'T _([...])'
+# This hack is needed to also process T_() function calls correctly with intltool-update
+# (in time formatter code).
+cd src/ && for file in *.cpp *.c; do sed -e "s/ T_/ T _/g" -i $file; done && cd - 1>/dev/null
+
+# Yet another hack to include .gschema.xml translations
+sed -i po/POTFILES.in -e 's/org.ayatana.indicator.datetime.gschema.xml.in$/org.ayatana.indicator.datetime.gschema.xml/g'
+cp data/org.ayatana.indicator.datetime.gschema.xml.in data/org.ayatana.indicator.datetime.gschema.xml
+
+# Run the intltool-update...
cd po/ && intltool-update --gettext-package ${GETTEXT_DOMAIN} --pot && cd - 1>/dev/null
-sed -e 's/\.xml\.in\.h:/.xml.in:/g' \
+# And revert...
+sed -i po/POTFILES.in -e 's/org.ayatana.indicator.datetime.gschema.xml$/org.ayatana.indicator.datetime.gschema.xml.in/g'
+rm data/org.ayatana.indicator.datetime.gschema.xml
+
+# And undo the renamings again.
+cd src/ && for file in *.cpp *.c; do sed -e "s/ T _/ T_/g" -i $file; done && cd - 1>/dev/null
+
+sed -E \
+ -e 's/\.xml\.in\.h:/.xml.in:/g' \
-e 's/\.ini\.in\.h:/.ini.in:/g' \
-e 's/\.xml\.h:/.xml:/g' \
-e 's/\.ini\.h:/.ini:/g' \
+ -e 's@^#: \.\./@#: @g' \
+ -e 's@(:[0-9]+) \.\./@\1 @g' \
-i po/${GETTEXT_DOMAIN}.pot