mainGNU gettext - Support: sr #109125, Detecting missing files in POTFILES

 
 

sr #109125: Detecting missing files in POTFILES

Submitter:  Piotr Drąg <piotrdrag>
Submitted:  Wed 24 Aug 2016 10:56:36 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Need Info
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 27 Oct 2018 05:14:48 PM UTC, comment #3: 

I would suggest looking into how intltool-update does it (https://bazaar.launchpad.net/~intltool/intltool/trunk/files). From my translator point-of-view, it scan the sources for files with keywords (_, ngettext, etc.) and writes a po/missing file listing the results. If a file is not in po/POTFILES.in intentionally, then I can add it to po/POTFILES.skip, and intltool-update -m ignores it.

> Detecting non-existent files is probably already present: xgettext will produce an error message when it accesses a non-existent file.


You’re right, I forgot about it.

Piotr Drąg <piotrdrag>
Sat 27 Oct 2018 04:45:18 PM UTC, comment #2: 

Note: The Autoconf project has a Makefile.maint that contains this target:


# Verify that all source files using _() are listed in po/POTFILES.in.
# FIXME: don't hard-code file names below; use a more general mechanism.
po-check:
        if test -f po/POTFILES.in; then                                        \
          grep -E -v '^(#|$$)' po/POTFILES.in                                \
            | grep -v '^src/false\.c$$' | sort > $@-1;                        \
          files=;                                                        \
          for file in $$($(CVS_LIST_EXCEPT)) lib/*.[ch]; do                \
            case $$file in                                                \
            djgpp/* | man/*) continue;;                                        \
            esac;                                                        \
            case $$file in                                                \
            *.[ch])                                                        \
              base=`expr " $$file" : ' \(.*\)\..'`;                        \
              { test -f $$base.l || test -f $$base.y; } && continue;;        \
            esac;                                                        \
            files="$$files $$file";                                        \
          done;                                                                \
          grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2;        \
          diff -u $@-1 $@-2 || exit 1;                                        \
          rm -f $@-1 $@-2;                                                \
        fi


And the gnulib/top/maint.mk contains the target sc_po_check, that does similar things:

# Verify that all source files using _() (more specifically, files that
# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
po_file ?= $(srcdir)/po/POTFILES.in
generated_files ?= $(srcdir)/lib/*.[ch]
_gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$)
sc_po_check:
        @if test -f $(po_file); then                                        \
          grep -E -v '^(#|$$)' $(po_file)                                \
            | grep -v '^src/false\.c$$' | sort > $@-1;                        \
          files=$$(perl $(perl_translatable_files_list_)                \
            $$($(VC_LIST_EXCEPT)) $(generated_files));                        \
          grep -E -l '$(_gl_translatable_string_re)' $$files                \
            | $(SED) 's|^$(_dot_escaped_srcdir)/||' | sort -u > $@-2;        \
          diff -u -L $(po_file) -L $(po_file) $@-1 $@-2                        \
            || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; };        \
          rm -f $@-1 $@-2;                                                \
        fi


Bruno Haible <haible>
Group administrator
Sat 27 Oct 2018 11:58:31 AM UTC, comment #1: 

Detecting non-existent files is probably already present: xgettext will produce an error message when it accesses a non-existent file.

Detecting missing files is a problem that I see more on the side of the build system (Automake) than in the Gettext package, because this missing file detection would need to know many things that are specific to the project:
  - Which files are source files, vs. which files are just random files created by the developer and not checked into version control?
  - Which directories contain tests and therefore should be ignored?
  - Which directories contain rapidly evolving (prototype-like) source, that is not yet ready for translation?
  - Which file suffixes are used for which programming language?

However, I would agree that a recommendation for how to deal with this problem could well be stated in the Gettext manual.

Do you have an idea how this recommendation should look like? Collect the list of files through some 'find' command or 'git' command? When: at 'make dist' time?

Bruno Haible <haible>
Group administrator
Wed 24 Aug 2016 10:56:36 AM UTC, original submission:  

The last big missing feature from intltool is detecting missing and non-existing files in POTFILES.in/.skip (intltool-update -m). It would be great if a similar feature could be implemented in gettext.

Piotr Drąg <piotrdrag>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by piotrdrag (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-27 haible StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-081f.
    Corresponding source code