summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2019-11-26 15:57:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-12-03 17:55:44 +0100
commit33c54d9475163a4c1b1246cca469b1d2934c265c (patch)
tree31467992f061067117020eac3ebda6e9236d5737 /solenv
parent0e2ab91c06eb42f6583989bd37a7537b9114b02f (diff)
hrc files are not using c-format strings, but use arbitrary placeholders
a happy mix of $1 %1 $(ARG1) %s %FOO and $bar$ and more is used, so don't claim it needs to be c-format as that will trigger false alerts for strings that use the percent sign as just percent sign. Change-Id: I5ad604e842f850550aeb38b10edd7f0ab215a0c9 Reviewed-on: https://gerrit.libreoffice.org/83784 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> (cherry picked from commit 48e1c6cc8ae5f24f27aefb7d50ca367324a40297) Reviewed-on: https://gerrit.libreoffice.org/83916 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'solenv')
-rwxr-xr-xsolenv/bin/hrcex8
1 files changed, 6 insertions, 2 deletions
diff --git a/solenv/bin/hrcex b/solenv/bin/hrcex
index 9d3a2788d4ba..1c371a1ed48e 100755
--- a/solenv/bin/hrcex
+++ b/solenv/bin/hrcex
@@ -5,7 +5,7 @@ import binascii
import getopt
import sys
import os.path
-from subprocess import check_output
+from subprocess import check_output, Popen, PIPE
try:
myopts, args = getopt.getopt(sys.argv[1:], "i:o:")
@@ -22,7 +22,11 @@ for o, a in myopts:
ofile = a
with open(ofile, "a") as output:
- input = check_output(["xgettext", "-C", "--add-comments", "--keyword=NC_:1c,2", "--keyword=NNC_:1c,2,3", "--from-code=UTF-8", "--no-wrap", ifile, "-o", "-"])
+ xgettext = Popen(["xgettext", "-C", "--add-comments", "--keyword=NC_:1c,2", "--keyword=NNC_:1c,2,3", "--from-code=UTF-8", "--no-wrap", ifile, "-o", "-"], stdout=PIPE)
+ # while overall format is c++, all of the strings use custom placeholders and don't follow c-format
+ # esp. plain percent sign never is escaped explicitly
+ input = check_output(['sed', '-e', '/^#, c-format$/d'], stdin=xgettext.stdout)
+ xgettext.wait()
po = polib.pofile(input)
if len(po) != 0:
print >> output, ""