locale specific for .desktop

Brian J. Tarricone bjt23 at cornell.edu
Thu Oct 18 02:12:32 PDT 2007


On Thu, 18 Oct 2007 17:55:11 +0900 Takao Fujiwara - Tokyo S/W Center
wrote:
> 
> Brian J. Tarricone wrote:
> > I guess I still don't understand why this is necessary.  If a user 
> > installs a piece of software that installs a .desktop file, my
> > feeling here is that they want to be able to see it regardless of
> > what LANG/LC_ALL is set to.  If it doesn't apply to their language
> > at all, then why would they have installed the app in the first
> > place?  If it's a distro-installed app that the user doesn't want,
> > it should show in the menu so the user is aware of it and can
> > uninstall it if he/she so desires.
> 
> Some of the applications are used on one locale only, e.g. Chinese
> dictionary application, Japan road map application. The situlation
> is, those applications are used for one country only, the native
> persons require to show the application by default, the native person
> usually uses one locale only. But we don't have suitable applications
> for all locales so the .desktop needs to be shown on one locale only.

So why the need to hide it?  As a user, if I install something, I
expect to see it in the menu[1].  To use your example, say I'm a
native-English speaker who is learning to speak Chinese (which actually
at one time was true).  I install the Chinese dictionary application,
but... well, it doesn't show up, because my LANG is en_US.UTF-8.  I'm
not going to quit my desktop session and restart in zh_CN (or zh_TW)
just to see the app.

If I install this Japanese road map application, I expect to see it in
my menu regardless of locale.  Say I live in the US, and I'm planning a
trip to Japan in which I'm going to do some driving.  I install the
road map app, but it doesn't appear in my menu.  As a user, I have no
idea what's going on.

The bottom line of what I'm trying to say is this: if I install an
application, I expect to see a menu item for it.  It shouldn't get
hidden depending on locale, ever.  If I don't want to see a menu item
for something for some reason, I'll edit the menu, or, if I don't want
the app anymore, I'll uninstall it.

So, I just don't see a need for this... unless I'm just grossly
misunderstanding your use case for this feature?

> > IMHO installing multiple .desktop files for an app (e.g. 1 per
> > language for some number of languages) is foolish, and just slows
> > down menu implementations.  The app itself should deal with the
> > locale appropriately by examining environment variables.
> > 
> > Personally, I'd prefer we didn't add complexity to the spec when
> > the same functionality can be handled outside it.
> 
> The problem is we don't have any way to handle this case.

Perhaps, but I don't think this needs "handling," at least not in the
way you're attempting to do it.  Applications that need to open
different files or run different programs based on locale should figure
it out on their own, and you shouldn't be hardcoding -- or
parameter-expanding -- locales in the .desktop files for that purpose
either.  A simple wrapper program/script that examines $LANG/$LC_ALL and
opens the appropriate file is the way to go.

	-brian

[1] The one case where I think it's ok to hide menu items for installed
applications are, for example, the menu items for the various GNOME
desktop settings applets while I'm running KDE or Xfce, or whatever.
If I'm running one DE, I'd expect to want to configure that DE and
not the others.  That's one of the reasons why we have OnlyShowIn.


More information about the xdg mailing list