locale specific for .desktop

Takao Fujiwara - Tokyo S/W Center Takao.Fujiwara at Sun.COM
Tue Oct 23 05:54:03 PDT 2007

All, thanks much for helps.


 > #1. Language specific launcher options.
 > I'ld like to switch the command options by languages.

You shouldn't be opening hardcoded paths in .desktop files anyway; if
you need to open different files depending on $LANG, you should write a
small helper application to figure things out for you.

each application needs to handle $LANG and $LANGUAGE.

 > #2. .desktop could be shown on a locale only.
 > I'ld like to show a locale specific application on the locale only in gnome-panel menus.

Just plug in your startup scripts a modification to XDG_DATA_DIRS and
move the offending .desktop into a directory which will be used only
when using specific locale. Or you can add a .menu file which will
hide .desktop and make sure this file is merged only when locale is set
(by modifying XDG_CONFIG_DIRS at login time).

 > #3. Filename encoding.
 > I'ld like to keep Encoding=UTF-8 but the actual filepath could be several encodings.

the full path is always saved as UTF-8 in .desktop even though the acual file path has the different encodings.

> 2. Can I assume the $XDG_DATA_DIRS have the fall back logic? e.g. if foo1.desktop is found in both /usr/share/applications and /usr/share/translations, /usr/share/translations/applications/foo1.desktop only is choosed. if foo2.desktop is found in /usr/share/applications but not /usr/share/translations, /usr/share/applications/foo2.desktop is choosed.
> I'm also finding the way to separate the l10n packages for .desktop.

OK, Base Directory Spec shows the implementation has the fall back logic:
 > The order of base directories denotes their importance; the first directory listed is the most important. When the same information is defined in multiple places the information defined relative to the more important base directory takes precedent. The base directory defined by $XDG_DATA_HOME is considered more important than any of the base directories defined by $XDG_DATA_DIRS. The base 
directory defined by $XDG_CONFIG_HOME is considered more important than any of the base directories defined by $XDG_CONFIG_DIRS.

I assume the .desktop files have the same information if C Name and Type fields have the same values and the translation fall back works.
If not, please correct me.


More information about the xdg mailing list