site  contact  subhomenews

Improved .desktop translation

September 26, 2012 — BarryK
MoManager manages translations for the .desktop files in /usr/share/applications.

Previously, only the 'Name' field was translated, I have now added the 'Comment' field.

A langpack PET created by MoManager has /usr/share/, which is a collection of .desktop files with the appropriate translated 'Name' and 'Comment' fields.
Refer to /usr/sbin/momanager to see how this directory is created, and /usr/share/doc/langpack-template/ for the langpack post-install script (which will perform the translations on /usr/share/applications).

I have extended this so that the Puppy Package Manager will recognise if /usr/share/ exists (meaning a langpack installed) and will apply a translation if a matching .desktop file exists in /usr/share/ when a package is installed.
Refer to script /usr/local/petget/

I think that L18L and others were modifying '' in their langpacks, but now need to consider return to the official script.

Woof commit:


Username: BarryK
p.s. Have made some mods to the scripts, have to do some urgent work, will get back online later and do another woof commit.

Re mods
Username: BarryK
"Ok, I was busy all day, at home this evening. I tweaked the code a bit, also modified MoManager slightly. A translator can now accumulate translated .desktop files in /usr/share/, and they will all be copied into the langpack PET. There was a restriction before, that only .desktop files of installed packages were being offered by MoManager for translation, and hence for inclusion in the langpack. Now however, the translator can make a big collection of them. Say that the translator installs OpenOffice and then uses MoManager to create translated .desktop files (assuming not already) -- MoManager places all .desktop files into usr/share/ in the langpack. In the future, say a different Puppy running, the translator installs the latest langpack, then those OpenOffice .desktop files will be installed also. When MoManager is used to create another langpack, those OpenOffice .desktop files will go into it. It does not matter that OO is not installed in the current pup. In this way, or even by manually inserting translated .desktop files into /usr/share/, the translator can create a langpack with a big collection of .desktop files to cater for future pkg installations. As already noted, the PPM checks in /usr/share/ when it installs a pkg. Latest Woof commit:

return to the official
Username: L18L
"First reason for the inofficial was that updating an existing translations was [b]not possible[/b]. 2nd: Entering new translations was [b]slow[/b], 1 minute for the refresh of momanager, so I had used /usr/share/sss/menu_strings for this. Yes, return to the official scripts sounds good! I will be working on that.

official 2
Username: L18L
"Barry, I did not see your last comment when submitting mine. So I am sorry if that sounds somewhat confusing. I will be working on that.

Username: L18L
"Barry, I have enabled translation of PACKAGE and KATEGORY in petget/ but I am not sure please look at Thank you

Updating .desktop
Username: BarryK
"L18L, Ah yes, I see. You wanted the langpack to update an already-existing translation in a .desktop file. Ok, done, see Woof commit:

Username: BarryK
"L18L, The file /tmp/petget-installed-pkgs-log written in must remain as English, as it gets parsed by other scripts -- well, currently only does that. So, I have implemented the translation of PACKAGE: and CATEGORY: in /usr/local/petget/petget and Woof commit: in langpack
Username: L18L
"[i]I think that L18L and others were modifying '' in their langpacks, but now need to consider return to the official script.[/i] Barry, see my post at forum please.

Re: new doesn't work
Username: BarryK
"rodin.s, I have tested with your ru langpack 120720 and the new Installing from the commandline: # petget /mnt/sda10/temp3/ The install script seems to have worked correctly. All .desktop files in /usr/share/applications have translation inserted. Only some files in /usr/share/desktop-directories are translated, as many .directory file names have changed. You will need to look at the new files and provide translations for them. The old only seemed to work correctly, as you were probably re-installing after having tried with the latest, not in a pristine puppy.

langpack hacks script
Username: BarryK
"L18L, Ok, I have put in a call to your hacks script, see Woof commit: I had a quick look at your hacks script. One problem is that you should not have absolute paths. Instead of "/usr/sbin/gparted_shell", have "./usr/sbin/gparted_shell" or "usr/sbin/gparted_shell". This is so the script will work if the langpack is selected in Woof, as a builtin package. Which would be the case if someone was building a German Puppy.

re: langpack hacks script
Username: L18L
"Thank you. Okay, so I will use relative paths.

Tags: woof