Comment 6 for bug 493403

Revision history for this message
fujiwara (takao-fujiwara) wrote :

Thanks for your commit.

Just now I noticed comment #2. Oops sorry, it seems I didn't receive email during the new year vacation.

> I wonder what those "lot of sources" are that would benefit from it?

Some of .py config file includes the build parameters with py.in
E.g.

foo.py.in:
datadir="@datadir@"
localedir="@datadir@/locale"
N_ = lambda x: x
FOO_A = N_("test")
FOO_B = N_("test2")

> does xgettext correctly pick up python-format as the syntax for such files?

Yes, I think so.
gettext/gettext-tools/src/xgettext.c:

...
          /* Remove a trailing ".in" - it's a generic suffix. */
          if (strlen (reduced) >= 3
              && memcmp (reduced + strlen (reduced) - 3, ".in", 3) == 0)
            reduced[strlen (reduced) - 3] = '\0';

          /* Work out what the file extension is. */
          extension = strrchr (reduced, '.');
          if (extension)
            ++extension;
          else
            extension = "";

          language = extension_to_language (extension);
...

gettext/gettext-tools/src/x-python.h:
#define EXTENSIONS_PYTHON \
  { "py", "Python" }, \

Thanks.