[Aptitude-devel] gtk aptitude and gettext and empty strings

Miroslav Kure kurem at upcase.inf.upol.cz
Sat Jun 20 15:31:52 UTC 2009


I was testing the GTK version of aptitude this weekend and have
noticed a small bug regarding localization.

If you have a list of packages displayed and you hover your mouse over
the status column, a tooltip pops up describing the current status and
a selected status.

When the "Selected status" description is empty, instead of an empty
string the header of the corresponding .po file is displayed.

If you have a look to the src/gtk/pkgview.cc, where the view is
constructed, the function selected_package_state_columns() on line 118
returns entity_state_info that has its description initiated to the
empty string.

When this empty string is handled further down line 172, gettext looks
up the corresponding string in .po file and returns the localized
string. Unfortunately, the empty string matches the dummy header
string in a .po file:

  msgid ""
  msgstr ""
  "Project-Id-Version: aptitude\n"
  "Report-Msgid-Bugs-To: aptitude at packages.debian.org\n"

For obvious reasons this does not happen if you run aptitude with no
locale like, i.e. LANG=C aptitude.

I would suggest to introduce new entity_state_info called
no_action_columns and use some other description than empty string
(ehm, space is enough). Proof of code attached.

Miroslav Kure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: status.diff
Type: text/x-diff
Size: 1393 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/aptitude-devel/attachments/20090620/37108c08/attachment.diff>

More information about the Aptitude-devel mailing list