Desktop Entry Specification
Takao Fujiwara - Tokyo S/W Center
Takao.Fujiwara at Sun.COM
Wed May 18 04:58:03 EEST 2005
Hi xdg members,
I'm working GNOME localization @ Sun.
I have a question regarding to .desktop file. Could you advice me?
Currently I'm working to separate multilingual files; .desktop, .icon, .key, .schemas, .xml and etc, by locale.
For .desktop files, I try to hack intltool-merge and the following is the implementation:
1. Add intltoolize and autoconf in each .spec files and replace intltool-merge and $INTLTOOL_DESKTOP_RULE with the hacked ones.
Then Makefile will have the following line:
.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; GETTEXT_PACKAGE=$(GETTEXT_PACKAGE) LC_ALL=C $(INTLTOOL_MERGE)
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
2. Add $INTLTOOL_ADD_COMMENT and $INTLTOOL_NO_TRANS parameters for 'make' in .spec files.
Then, .destop files will be made the following format from .desktop.in files.
This means the hacked intltool-merge addes '#_translated_tag' tag and 'X-GETTEXT_PACKAGE' tag when $INTLTOOL_ADD_COMMENT is defined.
3. Add L10n common packages for multilingual files and it addes .desktop files with translations from .mo files during the installation.
# env TEXTDOMAINDIR=/usr/share/locale intltool-merge $desktop_file -d -u -l ja_JP.UTF-8,fr_FR.UTF-8,it_IT.UTF-8,zh_CN.UTF-8 --merge
# env TEXTDOMAINDIR=/usr/share/locale intltool-merge $desktop_file -d -u -l ja_JP.UTF-8,fr_FR.UTF-8,it_IT.UTF-8,zh_CN.UTF-8 --demerge
Could you advice me about '#_translated_tag' tag and 'X-GETTEXT_PACKAGE'?
As you may know, Sun's packages are categorized, e.g. SUNWgnome-text-editor, SUNWgnome-text-editor-share, SUNWgnome-text-editor-root,
SUNWgnome-text-editor-devel, SUNWgnome-l10nmessages-ja. The base pacakges include /usr/bin, /usr/lib. $package-share include platform independency
files; /usr/share, $package-root include configuration files /etc and $package-l10n includes .mo files.
Currently our packages separate .mo files only by locale and users can choose the pacakges by locale. Our problem is when users don't install language
packages, GNOME desktop will be semi translations because of the multilingual files.
So we would like to have the option to separate multilingual files.
The main purpose to separate l10n packages is:
- Users want to display English messages but use locale resources; i.e. fonts, input methods.
- Provide the language options in the installation for users.
- Reduce disk usage.
I have tried three solutions.
Option 1. Change GNOME APIs.
Option 2. Update multilingual files with .po files durling the installation.
Option 3. Update multilingual files with .mo files durling the installation.
The above way to use the hacked intltool is the Option 3.
Option 1 is to change GNOME libraries to use .mo files. The implementation is:
1. If $USE_DESKTOP_ONLY == WITH_MO in /etc/X11/gdm/Xsessions but /usr/share/locale/$lang/LC_MESSAGES/*.mo is missed, UI is english.
2. If found the translation in multilingual files, return the translation.
3. If the translation is not found in multilingual files and $USE_DESKTOP_ONLY == WITH_MO, find the translation from a .mo file.
4. If the translation is not found in both multilingual files and .mo, return the English message.
The logic can keep the current implementation in case $USE_DESKTOP_ONLY is not set. I have the patches for libgnome, GConf, gnome-panel. I think this
is a best solution for Sun. But unfortunatelly when I contacted the gnome-panel maintainer, he thought the ability to
only install the translations for a selected set of languages is something that would be accepted upstream. And he also adviced me to use intltool-merge.
Then I tried to use Option 2 but it spend significant installation time so I implemented Option 3.
We also have another issue. When we add the third party's applications on GNOME, the .desktop files are always English, We need to add translations
but the translation process is complicated. When the application is added, we get .desktop files and translate the file and need to put back the
.desktop files to the application owners. We also would like to fix the problem.
Option 1 can fix it. Option 3 also can fix it when we add '--tag' option for intltool-merge. It means if we can manage build environments, we can add
the comments in .desktop files. If we cannot manage build environment, we use '--tag Name,Comment --domain gettext_name' with hard cordings.
I would like to hear your thoughts.
Our l10n hopes to upstream the solution into Community. At this moment, I picked up .desktop files but we need to separate all multilingual files.
Today, I subscribed this alias. So please send me the reply directly.
More information about the xdg