Some strings shows untranslated, albeit they're translated

Bug #361312 reported by Ricardo Pérez López on 2009-04-14
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
computer-janitor (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: computer-janitor

There're, at least, two strings that shows untranslated in my Spanish desktop, albeit they're translated in Launchpad template, and the translations are into the computerjanitor.mo file.

The two strings are:

- "File was left on the disk by dpkg as part of its configuration file handling. If your computer works fine, you can remove it. You may want to compare it with the actual configuration file (the one without the .dpkg-old or .dpkg-new suffix). If unsure, don't remove the file."
- "Package is no longer supported: it is no longer in the package archive. (It may also have been installed from an unofficial archive that is no longer available. In that case you may want to keep it.)"

which are translated in the following:

  https://translations.launchpad.net/ubuntu/jaunty/+source/computer-janitor/+pots/computerjanitor/es/44/+translate
  https://translations.launchpad.net/ubuntu/jaunty/+source/computer-janitor/+pots/computerjanitor/es/48/+translate

and the translations are into the computer-janitor.mo file:

$ strings -eS /usr/share/locale-langpack/es/LC_MESSAGES/computerjanitor.mo | grep "El paquete ya\|Dpkg"
Dpkg dejó el archivo en el disco como parte de su gestión de archivos de configuración. Si su equipo funciona bien, puede borrarlo. Puede que quiera compararlo con el archivo de configuración actual (el que no tiene el sufijo .dpkg-old o .dpkg-new). Si no es está seguro, no borre el archivo.
El paquete ya no está soportado: ya no está en el repositorio de paquetes. (También puede que se haya instalado desde un repositorio no oficial que ya no esté disponible. En ese caso, puede que quiera conservarlo.)

However, both strings shows untranslated in my Spanish desktop. I attach two screenshots to illustrate the problem.

Ricardo Pérez López (ricardo) wrote :
Ricardo Pérez López (ricardo) wrote :
Ricardo Pérez López (ricardo) wrote :

The problem is in the /usr/share/pyshared/computerjanitor/__init__.py file. The line:

  domain = 'update-manager'

should be

  domain = 'computerjanitor'

The patch is very simple and obvious. I attach it. Hope it's not too late for Jaunty release!

summary: - Some strings shows untranslated, albeit they're translated
+ Some strings shows untranslated, albeit they're translated (patch
+ supplied)
Martin Pitt (pitti) on 2009-04-15
Changed in computer-janitor (Ubuntu):
assignee: nobody → Lars Wirzenius (liw)
status: New → Triaged
to be removed (liw) wrote :

Ricardo,

how did you get "update-manager" there? The source says "computerjanitor".

summary: - Some strings shows untranslated, albeit they're translated (patch
- supplied)
+ Some strings shows untranslated, albeit they're translated
to be removed (liw) wrote :

Ah, now I see: the file you patched belongs to update-manager-core. The proper translation domain for that file is indeed update-manager, not computerjanitor.

to be removed (liw) wrote :

The reason the translations are not used is because the GTK UI is failing to call gettext in one place.

to be removed (liw) wrote :

Specifically, the problem is as follows:

* Part of the computer-janitor code is in the update-manager source package. This is necessary so that u-m can use c-j plugins. This code uses the "update-manager" translation domain.

* The rest of the computer-janitor code is in the computer-janitor package. This code uses the "computerjanitor" translation domain (no hyphen).

* The code to format the description of a package for the UI is in the part in update-manager. It failed to try to translate the reason for why something is cruft. (See update-manager/Janitor/computerjanitor/package_cruft.py, method get_description.)

* However, even if it had tried to do that, it would have failed, since the translation would have been in the wrong domain.

* Fixing this in computer-janitor isn't as simple as calling gettext on the return value of the get_description method, since get_description returns a string that combines the text explaining why something is cruft and the package description.

* Worse, this is specific to the type of cruft: it doesn't apply to all kinds of cruft. Special handling is needed for each type of cruft.

* The proper fix is to change the API for get_description so that it either returns translated text (and is given the translation domain), or else returns the translatable parts separately. However, this proper change is too much the night before feature freeze of all of Ubuntu. It would require a new update-manager upload as well as a bunch of testing to make sure the API change doesn't break anything anywhere.

* Thus, I will instead do something really ugly, and split up the returned value from get_description, and translate the appropriate part and the paste things back together the way they should be. This can be done inside computer-janitor, and everything will be localized. The worst that will happen is that computer-janitor-gtk will show some untranslated text.

to be removed (liw) wrote :

Oh, and additionally some of the plugins in computer-janitor are using the wrong gettext instance. I'll fix that as well.

to be removed (liw) on 2009-04-15
Changed in computer-janitor (Ubuntu):
status: Triaged → Fix Committed
Ricardo Pérez López (ricardo) wrote :

Wow! I had no idea this issue is so deep. Thank you very much for taking care of it. Many i18n issues are hard to find and fix.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package computer-janitor - 1.12.1-0ubuntu3

---------------
computer-janitor (1.12.1-0ubuntu3) jaunty; urgency=low

  * plugins/*.py: Fix to use the computerjanitorapp gettext instance,
    instead of the computerjanitor one. This should fix a couple of
    translations problems.
  * computerjanitorapp/ui_gtk.py: Really ugly (bug localized ugly!)
    hack to extract parts of cruft descriptions that need to be
    translated, translating them, and then putting back the whole
    description string again. (Closes: LP: #361312)

 -- Lars Wirzenius <email address hidden> Wed, 15 Apr 2009 18:22:01 +0300

Changed in computer-janitor (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers