Strings missing from the apport template

Bug #533565 reported by Gabor Kelemen on 2010-03-07
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Translations
Low
Unassigned
apport (Ubuntu)
Low
Martin Pitt
python-distutils-extra (Ubuntu)
Low
Martin Pitt

Bug Description

Binary package hint: apport

There are a few strings in gtk/apport-gtk and in kde/apport-kde, that marked for translation, but are not in the template.

In particular, in apport-gtk, we have:

    def ui_present_crash(self, desktop_entry):
        # adapt dialog heading and label appropriately
        if desktop_entry:
            heading = _('Sorry, %s closed unexpectedly') % desktop_entry.getName()
        elif self.report.has_key('ExecutablePath'):
            heading = _('Sorry, the program "%s" closed unexpectedly') % os.path.basename(self.report['ExecutablePath'])
        else:
            heading = _('Sorry, %s closed unexpectedly') % self.cur_package

apport-kde has this:

    def ui_present_crash(self, desktop_entry):
        # adapt dialog heading and label appropriately
        if desktop_entry:
            name = desktop_entry.getName()
            heading = _('Sorry, %s closed unexpectedly') % name
        elif self.report.has_key('ExecutablePath'):
            name = os.path.basename(self.report['ExecutablePath'])
            heading = _('Sorry, the program "%s" closed unexpectedly.') % name
        else:
            name = self.cur_package
            heading = _('Sorry, %s closed unexpectedly.') % name

The strings should show up here:
https://translations.launchpad.net/ubuntu/lucid/+source/apport/+pots/apport/hu/+translate?batch=10&show=all&search=unexpectedly

I guess

Gabor Kelemen (kelemeng) wrote :
David Planella (dpm) on 2010-03-08
Changed in ubuntu-translations:
status: New → Triaged
importance: Undecided → Low
David Planella (dpm) wrote :

It seems that none of the strings from gtk/apport-gtk are extracted.

apport uses python-distutils-extra, so the file should have been processed and the strings extracted without the need for a POTFILES.in.

I've tried generating the template locally with './setup.py build_i18n', but it seems to present the same problem: strings from gtk/apport-gtk are not extracted

Gabor Kelemen (kelemeng) wrote :

Okay, I found it :)

The problem is that the files do not have a .py extension, thus xgettext tries to parse them as C files. This would not be a problem (update-manager has ), if strings were enclosed between " marks, but they are between ' marks, which is valid for python, but not for C.

So, we can either:

-rename the files to apport-{gtk|kde}.py
-or put the strings between " marks.

Also, it is worth noting that intltool-update -m does not detect these files, probably because of the lacking .py extension, so I think we will need to use POTFILES.in, if we decide to not use .py extensions.

Gabor Kelemen (kelemeng) wrote :

I also wanted to add to the third sentence:
(update-manager has files like this: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/lucid/update-manager/lucid/annotate/head%3A/update-manager)

El dj 11 de 03 de 2010 a les 10:52 +0000, en/na Gabor Kelemen va
escriure:
> Okay, I found it :)
>
> The problem is that the files do not have a .py extension, thus xgettext
> tries to parse them as C files. This would not be a problem (update-
> manager has ), if strings were enclosed between " marks, but they are
> between ' marks, which is valid for python, but not for C.
>

Generally, this would be a problem for extensionless scripts using
intltool (see bug 377872), but apport uses python-distutils-extra, which
IIRC works around this by creating temporary symlinks to .py files
before calling intltool, only to delete them afterwards. You can also
see this in all p-d-e created templates, where the source code
references sometimes refer to 'somescript.py', where there is actually
only an extensionless 'somescript'.

> So, we can either:
>
> -rename the files to apport-{gtk|kde}.py
> -or put the strings between " marks.
>
> Also, it is worth noting that intltool-update -m does not detect these
> files, probably because of the lacking .py extension, so I think we will
> need to use POTFILES.in, if we decide to not use .py extensions.
>

Unfortunately having a POTFILES.in file would not help here, either,
since currently intltool only detects by extension or [type: ]
specifier. For builtin types, such as python, there is no way to specify
the type e.g. [type: gettext/python], so they are generally parsed by
xgettext as C files.

I think the issue here might be to find out why python-distutils-extra
does not detect the apport-{gtk|kde} files as python scripts.

The ' vs " is an interesting point, though.

Actually, yes, looking at update-manager, it seems that having a POTFILES.in file and using python-distutils-extra would work, although the files will be parsed as C files.

This will not be a problem if they have e.g. %s variables, which are common to C and python, but it might be a problem if the python scripts use %(variable)s type variables.

summary: - Strings missing from the template
+ Strings missing from the apport template
Martin Pitt (pitti) wrote :

python-distutils-extra works around the extension limitation by temporarily creating .py symlinks and adding those to POTFILES.in. But somewhere in this chain things break. I'll have a closer look at this.

Changed in apport (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Martin Pitt (pitti) wrote :

I just extended the p-d-e test suite to confirm that this generally works:

http://bazaar.launchpad.net/~python-distutils-extra-hackers/python-distutils-extra/debian/revision/170

Looking at apport itself now.

Martin Pitt (pitti) wrote :

Ah, the reason is that p-d-e currently only considers stuff in bin/ or *.py, but gtk/apport-gtk is neither. So we need an explicit POTFILES.in here.

Ideally projects could have a partial POTFILES.in.in, and DistUtilsExtra.auto would just add that to the autogenerated POTFILES.in.

Martin Pitt (pitti) wrote :

I filed bug 566619 about the p-d-e enhancement.

I don't think that this issue is very important for lucid, since we disable Apport by default and for bug reporting you need to speak some English anyway. So I'll just fix this for maverick.

Changed in apport (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Martin Pitt (pitti) wrote :

Thinking about it some more, an explicit POTFILES.in.in is unnecessary and also unintuitive since we'd need the extra hack of a temporary .py symlink. We already have gtk/apport-gtk in apport's setup.py, so DistUtilsExtra.auto should just respect that.

Changed in python-distutils-extra (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → Low
status: New → In Progress
Martin Pitt (pitti) wrote :

Fixed in p-d-e r171

Changed in python-distutils-extra (Ubuntu):
status: In Progress → Fix Committed
Martin Pitt (pitti) on 2010-04-22
Changed in apport (Ubuntu):
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-distutils-extra - 2.19

---------------
python-distutils-extra (2.19) unstable; urgency=low

  * auto.py: Also recognize Qt .ui files if they start with an "<?xml..."
    first line. (LP: #543707)
  * test/auto.py: Check that automatic translation extraction also works for
    extensionless files and single quotation marks. (Side discussion in
    LP #533565)
  * test/auto.py: Check that scripts explicitly mentioned in "data_files" and
    "scripts" are covered by the automatic POTFILES.in generation. This
    reproduces LP #533565.
  * auto.py: Include scripts in setup.py's data_files into potential
    POTFILES.in candidates. (LP: #533565)
  * debian/control: Swap maintainer (me) and uploaders (Sebastian), since I'm
    the de-facto maintainer now.
  * debian/control: Replace python-all-dev build dependency with python-all,
    which is enough. Also wrap build dependencies.
  * Add debian/source/format: 3.0 (native).
  * setup.py: Grab version from DistUtilsExtra/auto.py instead of duplicating
    and hardcoding it.
  * python_mkdebian: Add --version option.
  * Move primary __version__ definition to DistUtilsExtra/__init__.py, where
    it makes more sense than just in the auto module.
  * Add debian/local/python-mkdebian.1. (Closes: #546266)
  * Add debian/python-distutils-extra.manpages to install the new manpage.
 -- Martin Pitt <email address hidden> Sun, 09 May 2010 11:19:47 +0200

Changed in python-distutils-extra (Ubuntu):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 1.14-0ubuntu1

---------------
apport (1.14-0ubuntu1) maverick; urgency=low

  * New upstream release:
    - hookutils.py: Add new method attach_drm_info() to read and format
      /sys/class/drm/*. (desktop-maverick-xorg-gpu-freeze-reports)
    - packaging-apt-dpkg.py: Fix deprecated python-apt variables, thanks David
      Stansby. (LP: #591695)
    - launchpad.py: Fix crash on attachments which are named *.gz, but
      uncompressed. (LP: #574360)
    - hookutils.py, attach_gconf(): Fix defaults parsing for boolean keys.
      (LP: #583109)
  * debian/control: Bump p-distutils-extra build-dependency to 2.19, to ensure
    that we get a complete translation template. (LP: #533565)
 -- Martin Pitt <email address hidden> Wed, 16 Jun 2010 15:50:55 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Gabor Kelemen (kelemeng) on 2010-08-25
Changed in ubuntu-translations:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers