From 5a3d40c4d18773fa7db1b09dd266cf1e4ed1ab0f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 28 Apr 2020 09:42:29 +0200 Subject: [PATCH] bin/update: Re-add the PoEdit header extensions on each update --- bin/update | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/update b/bin/update index 77de39d8..cebe27ee 100755 --- a/bin/update +++ b/bin/update @@ -68,6 +68,21 @@ xgettext --language=PHP \ --default-domain=icinga \ --output=icinga.pot +# Re-add the PoEdit header extensions +REPLACE_CODE=$(cat << PYTHON +import sys, re +result = re.sub( + r'msgid \"\"\nmsgstr \"\"(\n\".*\")+', + '\g<0>\n' + + '\"X-Poedit-Basepath: ../../../src\\\\\\\\n\"\n' + + '\"X-Poedit-SearchPath-0: sources.d\\\\\\\\n\"', + sys.stdin.read() +) +sys.stdout.write(result) +PYTHON +) +cat icinga.pot | python -c "$REPLACE_CODE" > temp; mv temp icinga.pot + # Cleanup created files and directories rm catalog.txt for repo_name in "${FETCHED_REPOS[@]}"; do