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/applications.in, 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/pinstall.sh 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/applications.in exists (meaning a langpack installed) and will apply a translation if a matching .desktop file exists in /usr/share/applications.in when a package is installed.
Refer to script /usr/local/petget/installpkg.sh.

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

Woof commit:
http://bkhome.org/fossil/woof2.cgi/info/1e322e20c7

Comments

mods
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/applications.in, 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/applications.in 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/applications.in, 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/applications.in when it installs a pkg. Latest Woof commit: http://bkhome.org/fossil/woof2.cgi/info/3782b41e52

return to the official pinstall.sh
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 pinstall.sh 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.

ppm
Username: L18L
"Barry, I have enabled translation of PACKAGE and KATEGORY in petget/installpkg.sh but I am not sure please look at http://www.murga-linux.com/puppy/viewtopic.php?t=81077 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: http://bkhome.org/fossil/woof2.cgi/info/4f189d21eb

Re PACKAGE and CATEGORY
Username: BarryK
"L18L, The file /tmp/petget-installed-pkgs-log written in installpkg.sh must remain as English, as it gets parsed by other scripts -- well, currently only downloadpkgs.sh does that. So, I have implemented the translation of PACKAGE: and CATEGORY: in /usr/local/petget/petget and downloadpkgs.sh. Woof commit: http://bkhome.org/fossil/woof2.cgi/info/3736ce15d6

pinstall.sh in langpack
Username: L18L
"[i]I think that L18L and others were modifying 'pinstall.sh' in their langpacks, but now need to consider return to the official pinstall.sh script.[/i] Barry, see my post at forum http://www.murga-linux.com/puppy/viewtopic.php?p=655552 please.

Re: new pinstall.sh doesn't work
Username: BarryK
"rodin.s, I have tested with your ru langpack 120720 and the new pinstall.sh. Installing from the commandline: # petget /mnt/sda10/temp3/langpack_ru-20120720.pet 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 pinstall.sh only seemed to work correctly, as you were probably re-installing after having tried with the latest pinstall.sh, 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: http://bkhome.org/fossil/woof2.cgi/info/5c8ab364b5 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