Menu

#87 Problem with .desktop file

closed
nobody
None
5
2012-07-26
2009-07-28
loic
No

Hi,
In order to solve a bug filed for qgo in Ubuntu - but which should affect any Linux distribution AFAIK (https://bugs.launchpad.net/ubuntu/+source/qgo/+bug/381704), I need to patch the file templates/qgo.desktop (which doesn't seem be fully Freedesktop.org specs compliant).

Problem is, when opening qgo.desktop in UTF-8 (which is default anyway, even though it's also specified in the .desktop file), most translations have ?? - and Kate warns that the file hasn't been encoded in UTF-8. With a hexadecimal editor, the problem is the same (3F everywhere for all those "?"), and that's with the file distributed with the tarball too.

Here are the invalid translations:
GenericName[ar]=??
GenericName[bg]=??
GenericName[br]=c'hoari
GenericName[el]=???
GenericName[eo]=Goo
GenericName[fr]=Jeu de go
GenericName[ga]=G�
GenericName[he]=??
GenericName[id]=Igo
GenericName[is]=G�
GenericName[ja]=??
GenericName[jbo]=gos
GenericName[ko]=??
GenericName[la]=Igo
GenericName[mn]=??
GenericName[ru]=??
GenericName[th]=????????
GenericName[uk]=??
GenericName[vi]=C? v�y
GenericName[zh]=??

As a note, it's also possible to get the .desktop file translated within the project .po files (I don't know what you use, but that should work too), so it's also taken care of by translators.

Discussion

  • Peter

    Peter - 2009-08-27

    There will be a new version of qGo soon, so far it doesn't even have a .desktop file. I contacted one of the other admins but haven't heard back on this. If you want to tell me what's necessary with this, that would be helpful.

     
  • loic

    loic - 2009-08-29

    Is the new version qGo or qGo2?

    Here's a basic qgo.desktop file for qgo, retaining the various KDE-related extensions present in the old one.

    [Desktop Entry]
    Type=Application
    Name=qGo
    GenericName=Go client
    Comment=Play the Go board game, view and edit SGF files
    Icon=qgo
    Exec=qgo
    Terminal=false
    MimeType=text/plain;text/sfg;
    Categories=Qt;KDE;Game;BoardGame;
    X-KDE-SubstituteUID=false
    X-KDE-Username=
    X-DCOP-ServiceType=Multi
    X-KDE-StartupNotify=true

    Note that the icon should be put in /usr/share/pixmaps (and preferably qgo.TYPE, where type is SVG, PNG and XPM - installing at least one of the first two for modern desktops, and one XPM 32x32 for legacy ones), and that the .desktop file Icon entry shouldn't specify the .TYPE nor the path, letting the DE chose the best type it can support.

    qgo.desktop should be installed in /usr/share/applications, but I think that's what you already do.

    The freedesktop spec is at http://standards.freedesktop.org/desktop-entry-spec/latest/
    See the "Recognized desktop entry keys" entry for descriptions of the different keys.

    You can use the utility desktop-file-validate on your resulting .desktop file to spot remaining errors, it's quite convenient and should be in any Linux distribution repositories.

    Translations can be done inside the .desktop file, or (better) you can add qgo.desktop to the list of files that have to be translated (gettext or any other tool you use), so any new translator also translates the Name/GenericName/Comment key when they translate the application.

    Just for info, French translations for the keys above would appear like that in the resulting .esktop file:
    Name[fr]=qGo
    GenericName[fr]=client de Go
    Comment[fr]=Jouer au Go, un jeu de plateau, lire et éditer des fichiers SGF

     
  • loic

    loic - 2009-08-29

    Just forgot: you could also fix sgf.desktop in the same way, i.e. the Icon= key which would be Icon=qgo (in case you move the installed icon to qgo.TYPE and install it in the right location, which you'd have to do to fix ago.desktop anyway.

     
  • Peter

    Peter - 2009-08-29

    Okay, I'm looking into it. I assume mimetype is supposed to be text/sgf not text/sfg?

     
  • Peter

    Peter - 2009-08-29

    Also, is there a standard way to tell if KDE is installed?

     
  • loic

    loic - 2009-08-29

    I suppose so. I actually copied the MimeType key (and all the X-### keys) straight from the old qgo desktop file, and didn't try to outsmart what they where. It should be safe to assume it's sgf indeed, and also the X-KDE-Username= key is empty and might be discarded - but I'm no KDE expert.

    As for telling if KDE is installed, do you mean at install time or at startup, and for what reason? I can try asking in #ubuntu-motu on freenode, but it might take a few days, since it's both end of holiday for most and a quiet week-end night ;)

     
  • Peter

    Peter - 2009-09-01

    I see what you mean, I was thinking .desktop files were a KDE thing but its open desktop.

    Well, I've committed .desktop files in english only to the qgo2 repository. But it will just be qgo 2.0.0 eventually. I'd also like to have a different icon for sgf files but I'm not really good at making icons.

     
  • Nobody/Anonymous

    Since you're there, could you please also add the menu file that's been in Debian packages for a while, to be installed in /usr/share/menu ? It uses 2 .XPM icons, one a 32x32 (default for XPM), one a 16x16. So there will be a .desktop file (/usr/share/applications) for recent desktop like Gnome/KDE, and a menu file for legacy desktops?

    ?package(qgo):\ needs="x11"\ section="Games/Board"\ hints="KDE,Go"\ title="qGo"\ icon32x32="/usr/share/pixmaps/qgo.xpm"\ icon16x16="/usr/share/pixmaps/qgo-16.xpm"\ command="/usr/games/qgo"

     
  • Peter

    Peter - 2009-09-01

    I looked into it and I can't even save xpm files. I'd have to recompile it ans mess around a bunch. In addition this was kind of why I asked about KDE earlier in this thread. It seems like open desktop is the standard, otherwise its necessary to install a different desktop file depending upon the desktop manager.

    I'm going to let the debian package manager handle debian for right now. Maybe if I get a chance later I'll mess with it.

     
  • Nobody/Anonymous

    I'm not sure I understand, or maybe I confused you because I wasn't clear. There's already an XPM icon in your tarball, it's src/pics/Bowl.xpm and 32x32. The Bowl.png icon could be bigger, since the standard is 48x48 for the PNG ones, but there's not much point resizing it unless there's a higher resolution one around. As for saving in XPM, it's standard with Gimp, no need to recompile (at least under Linux), but you already have the two icons anyway.

    As far as desktop environments are concerned, it's enough to have /usr/share/applications/qgo.desktop and /usr/share/menu/qgo - with that you get all freedesktop compliant DE covered.
    .desktop, menu and PNG/XPM aren't a Debian thing, it's just Debian tends to put more attention to those things, which prevents having apps that don't show up in the menus.

     
  • Peter

    Peter - 2009-09-02

    Well, not sure. There's a different icon in qgo 2, I could copy the old xpm, my gimp, (on gentoo) wouldn't even do png files without a recompile. And then I'm not sure how "make install" from a qmake project file works for different icons. Maybe I'll mess with it some more.

     

Anonymous
Anonymous

Add attachments
Cancel