intltool: Would check_po.pl be useful?

Bug #182606 reported by Richard Laager
4
Affects Status Importance Assigned to Milestone
intltool
Invalid
Low
intltool (Ubuntu)
Invalid
Wishlist
Unassigned

Bug Description

Binary package hint: intltool

Pidgin has a script named check_po.pl. I'm submitting it here in case it'd be
useful as part of the intltool suite. I'll upload it as an attachment once this
bug is created.

One of our translators said:

I think "msgfmt -c" only finds hard errors in .po files. In most cases,
the "msgfmt -c" errors prevent the compilation, if they are not fixed:

An example:

    #: ../src/ft.c:442
    #, c-format
    msgid "%s is not a valid filename.\n"
    msgstr "%s ist kein gültiger Dateiname."

Because of the missing line ending ("\n") the file can not be compiled.

    $ msgfmt -c de.po
    de.po:2121: `msgid' and `msgstr' entries do not both end with '\n'
    msgfmt: found 1 fatal error

    $ make
    file=`echo de | sed 's,.*/,,'`.gmo && rm -f $file &&
    /usr/bin/msgfmt -o $file de.po
    de.po:2121: `msgid' and `msgstr' entries do not both end with '\n'
    /usr/bin/msgfmt: found 1 fatal error
    *** Error code 1

check_po.pl is more a "lint" tool for gettext. It finds very much
possible problems in .po files (from check_po.pl):

    # Various checks on po file translations:
    # - printf-style format strings;
    # - differences in trailing newlines;
    # - empty (non-fuzzy) msgid;
    # - likely whitespace errors on joining multi-line entries
    # Ignores all fuzzy entries.
    #
    # Options:
    # -x Don't do standard checks above (eg, just check one of below).
    # -n Check newlines within strings; ie, that have equal numbers
    # of newlines in msgstr and msgid. (Optional because this may
    # happen legitimately.)
    # -w Check leading whitespace. Sometimes whitespace is simply
    # spacing (eg, for widget labels etc), or punctuation differences,
    # so this may be ok.
    # -W Check trailing whitespace. See -w above.
    # -p Check trailing punctuation.
    # -c Check capitalization of first non-whitespace character
    # (only if [a-zA-Z]).
    # -e Check on empty (c.q. new) msgstr

I use both tools with the following options:

msgfmt:

    $ LANG=C msgfmt --check --check-accelerators=_ -c de.po

This does the standard checks (-c|--check) and also checks presence of
keyboard accelerators for menu items.

check_po.pl:

    ./check_po.pl -xnwWpce de.po

This does not do the standard checks (because I don't want to see all
the "*** Possible non-whitespace line-join problem in msgstr" warnings -
I think this are false-positives). But it checks for other problems like
different trailung punctuations. See above for the meanings of the other
switches.

Revision history for this message
Richard Laager (rlaager) wrote :
Changed in intltool:
status: Unknown → New
Daniel T Chen (crimsun)
Changed in intltool:
importance: Undecided → Wishlist
Changed in intltool:
importance: Unknown → Low
status: New → Triaged
Changed in intltool:
status: Triaged → New
Changed in intltool:
status: New → Unknown
Changed in intltool:
status: Unknown → Invalid
Changed in intltool (Ubuntu):
status: New → Confirmed
Richard Laager (rlaager)
Changed in intltool (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.