bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] maint.mk: let packages tweak sc_po_check pattern


From: Jim Meyering
Subject: Re: [PATCH] maint.mk: let packages tweak sc_po_check pattern
Date: Sun, 28 Oct 2012 09:06:54 +0100

Eric Blake wrote:
> libosinfo wants to look for XML files with translation markers
> of the form <_name>string to translate</_name>.  Rather than
> globally adding this to the regex, I thought it would be easier
> to make it possible for cfg.mk to override the default pattern.
> https://www.redhat.com/archives/virt-tools-list/2012-October/msg00270.html
>
> * top/maint.mk (sc_po_check): Add files-with-translation, to allow
> finding files with other translation markers.

That's clearly adding a new knob that projects like libosinfo can use
and making no other change.
ACK.

However, that new variable name doesn't tell me as much as I'd like
about its function.  How about changing it to indicate that this new
variable is a regular expression?  We haven't been consistent with
RE-related variable names, with -regex, _..._re, _re_, _RE, _match,
-regexp, (I suppose it's the usual tension between not wanting to use
_regular_expression or, heaven forbid, _extended_regular_expression,
and the obtuseness of _RE or _ERE) but since we already have this:

    # A regexp matching function names like "error" that may be used
    # to emit translatable messages.
    _gl_translatable_diag_func_re ?= error

I suggest the following.
Besides, adding a "_" prefix is more name-space friendly.


>From 4e0b109267214af6a5b56431a7403b6db4b8dddc Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 28 Oct 2012 08:38:09 +0100
Subject: [PATCH] maint.mk: rename a new configurable variable

* top/maint.mk (_gl_translatable_string_re): Rename from
translation-markers: _gl_ prefix to insulate from user Makefile code,
and the _re suffix to inform that it's a regular expression.
---
 ChangeLog    | 7 +++++++
 top/maint.mk | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a379c32..ea23e5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-10-28  Jim Meyering  <address@hidden>
+
+       maint.mk: rename a new configurable variable
+       * top/maint.mk (_gl_translatable_string_re): Rename from
+       translation-markers: _gl_ prefix to insulate from user Makefile code,
+       and the _re suffix to inform that it's a regular expression.
+
 2012-10-26  Eric Blake  <address@hidden>

        maint.mk: let packages tweak sc_po_check pattern
diff --git a/top/maint.mk b/top/maint.mk
index de7a303..ea44ece 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1122,10 +1122,10 @@ fix_po_file_diag = \
 apply the above patch\n'

 # Verify that all source files using _() (more specifically, files that
-# contain the ERE translation-markers) are listed in po/POTFILES.in.
+# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
 po_file ?= $(srcdir)/po/POTFILES.in
 generated_files ?= $(srcdir)/lib/*.[ch]
-translation-markers ?= \b(N?_|gettext *)\([^)"]*("|$$)
+_gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$)
 sc_po_check:
        @if test -f $(po_file); then                                    \
          grep -E -v '^(#|$$)' $(po_file)                               \
@@ -1145,7 +1145,7 @@ sc_po_check:
            esac;                                                       \
            files="$$files $$file";                                     \
          done;                                                         \
-         grep -E -l '$(translation-markers)' $$files                   \
+         grep -E -l '$(_gl_translatable_string_re)' $$files            \
            | sed 's|^$(_dot_escaped_srcdir)/||' | sort -u > address@hidden;    
\
          diff -u -L $(po_file) -L $(po_file) address@hidden address@hidden     
                \
            || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; };   \
--
1.8.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]