[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: desktop and/or menu files localization (was: Re: adding desktop files to misc packages)



On Sat, 14 Jul 2007 07:54:58 +0200
Christian Perrier <bubulle@debian.org> wrote:

> (crossposted to -i18n)
> Speaking about desktop files l10n, the current way to
> translate them does not seem to scale very well to me.
> 
> From what I see in the dozens of .desktop files I have on my own
> system, I see "Field[code]" fields for translations of "Field". 
> 
> This is similar to what we had, in the past, for debconf templates and
> we all known this doesn't scale and doesn't handle changes to English
> strings very well.

The strings used to generate translated .desktop entries can (should)
come from the upstream po/ directory via gettext - it can be handled
directly using gettext and make. All my upstream projects include all
translatable strings for the .desktop file in the .gmo (and therefore
the installed .mo) yet these also exist in the .desktop file that is
eventually installed. If an upstream package uses autofoo and does not
create a translated .desktop file for the .orig.tar.gz, that is (IMHO)
an upstream bug.

The thing is, that happens with debian/templates as well. Using
deb-gview, I can view any package that uses debconf with translations
in debian/po and the templates file in the .deb itself (part of
the control.tar.gz of the .deb) increases in size every time a new
translation is added to debian/po and contains long, long lists of
repeated translated strings. From an embedded perspective, I'd love to
lose this duplication:

debconf template (from emdebian-tools 0.3.0 .deb)
Description: Use apt-get to install toolchains?
 emsetup can install toolchain packages for you using apt-get.
 Alternatively, unset this option to use aptitude.
Description-cs.UTF-8: Použít pro instalaci nástrojů apt-get?
 emsetup může automaticky nainstalovat balíky s nástroji pomocí
apt-get. Chcete-li použít aptitude, tuto možnost odmítněte.
Description-de.UTF-8: Soll apt-get zur Installation der Werkzeugkette
verwendet werden? Emsetup kann die Pakete der Werkzeugketten für Sie
mittels apt-get installieren. Alternativ lehnen Sie diese Option ab, um
Aptitude zu verwenden.

desktop file (from gpe-expenses .deb)
Comment=Simple Expenses records for GPE
Comment[cs]=Jednoduché záznamy o výdajích pro GPE
Comment[de]=Einfache Spesenaufzeichnung für GPE
Comment[pt]=Registos simples de Despesas para GPE

I'd agree that BOTH of these should be able to read the .mo just like
the application itself. I don't know if that is achievable. gettext
does support non-compiled implementations like Perl or PHP so there
should be some method of retrieving the strings directly from the .mo
so that both the debconf templates AND the .desktop file contain ONLY
the original "marked up" translatable strings and not the actual
translations. i.e. deal with .desktop and debconf in the same way as
the executable. gettext can do it - it works for PHP and Perl.

debconf template (from emdebian-tools 0.3.0 .deb)
_Description: Use apt-get to install toolchains?
 emsetup can install toolchain packages for you using apt-get.
 Alternatively, unset this option to use aptitude.

desktop file (from gpe-expenses .deb)
_Comment=Simple Expenses records for GPE

Or similar syntax to "markup" the strings:
debconf template (from emdebian-tools 0.3.0 .deb)
Description: _("Use apt-get to install toolchains?")
 _("emsetup can install toolchain packages for you using apt-get.
 Alternatively, unset this option to use aptitude.")

desktop file (from gpe-expenses .deb)
Comment=_("Simple Expenses records for GPE")

So I don't follow the logic above - AFAICT we still have the
debconf system that you describe as "in the past" - we just changed the
syntax. It is an improvement over Field[code] but it seems to me to be
an incomplete transition.

> So whatever choice is Good or Bad, there's an interesting problem to
> work on: develop a gettext-based system to translate .desktop or .menu
> files.

AFAICT what we need is the ability to retrieve the translated strings
from /usr/share/locale/$lang/LC_MESSAGES/$app.mo rather than copying
them en masse into /usr/share/applications/foo as well (and then doing
the same again in /usr/share/menu if we translate menu files too).

> Indeed, it would be good to have something allowing such strings to go
> in a debian/po directory, much similarly to what's currently done with
> debconf templates. Then the translated .desktop or menu files would be
> built at package build time from the original file and the set of
> gettext translations in debian/po

This is what I don't follow, Christian - I already do this upstream.
desktop/app.desktop.in.in can be preprocessed in packages using
autotools to handle gettext. The translated .desktop file is built at
package build time from the original file and the set of gettext
translations in the upstream po/ directory.

-- 

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

Attachment: pgp279SSGf5JU.pgp
Description: PGP signature


Reply to: