[Libreoffice-commits] core.git: solenv/bin

Christian Lohmaier (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 14:29:29 UTC 2019


 solenv/bin/hrcex |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 48e1c6cc8ae5f24f27aefb7d50ca367324a40297
Author:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
AuthorDate: Tue Nov 26 15:57:42 2019 +0100
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Wed Nov 27 15:27:47 2019 +0100

    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 at googlemail.com>

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, ""


More information about the Libreoffice-commits mailing list