how to translate .desktop files for multimedia-menus

Asgeir Frimannsson asgeirf at redhat.com
Mon Aug 10 03:41:04 UTC 2009


----- "Orcan Ogetbil" <oget.fedora at gmail.com> wrote:
> On Sun, Aug 9, 2009 at 10:11 PM, Dimitris Glezos wrote:
> > On Sun, Aug 9, 2009 at 11:46 PM, Orcan Ogetbil wrote:
> >> Hello list,
> >>
> >> The new FedoraStudio feature we will have with F-12 comes with an
> >> optional multimedia-menus package. By installing this package,
> users
> >> will have a categorized Sound&Video/Multimedia menu in their
> desktop
> >> menu.
> >>
> >> The names of these submenus are defined in .desktop files. It
> appears
> >> to be that the Name and Comment keys in these .desktop files need
> >> translations. We have about 20-22 strings waiting for translation.
> I
> >> couldn't find a way to make Transifex talk to .desktop files maybe
> >> because I am not much familiar with it. I was advised on IRC to
> write
> >> on this list.
> >
> > If there's a tool to convert a .desktop file into a POT file, and
> then
> > host this on fedorahosted, we could set it up pretty easily.
> >
> 
> Alright. I believe that I can produce a .pot file from the .desktop
> files via xgettext. How about the other way around? Is there a .po
> file parser that I can use to put the translated strings back into
> the
> .desktop files?
> 
> For instance, assume that we have a .desktop file with the line:
> 
> Comment="Blue"
> 
> Now, after the translations are done, (.desktop -> .pot -> .po ->
> .desktop) I want these lines added to the .desktop file:
> 
> Comment[de]=Blau
> Comment[fr]=Bleu
> etc.
> 
> 
> If there's such a parser, I can write a simple Makefile to generate
> the final .desktop files. Otherwise I'll write my own parser.

You can do this extraction/merging easily with intltool, and let translators work with PO files.

You might find a better reference to this in the Gnome or Intltool documentation, but here's a 1-minute overview:

1) In your ./my.desktop.in file, prepend localizable entries with '_'
E.g.
_Comment=A Comment
_Name=Name of Application

2) Create a ./po directory and create a POTFILES.in file where you add 'my.desktop.in' to the list of source-files

3) Now you can run in your ./po directory 
intltool-update -p

You will now have a POT file in you ./po directory for translators to translate

4) After translation, you can merge changes back into your my.desktop file doing something like:
intltool-merge -d po my.desktop.in my.desktop

Feel free to catch me on IRC if you need any clarification.

cheers,
asgeir




More information about the Fedora-trans-list mailing list