Improved .desktop translation

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


Posted on 26 Sep 2012, 9:43


Comments:

Posted on 26 Sep 2012, 10:02 by BarryK
mods
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.



Posted on 26 Sep 2012, 18:51 by BarryK
Re mods
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



Posted on 26 Sep 2012, 19:08 by L18L
return to the official pinstall.sh
First reason for the inofficial was that updating an existing translations was not possible.

2nd: Entering new translations was slow, 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.




Posted on 26 Sep 2012, 19:15 by L18L
official pinstall.sh 2
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.







Posted on 26 Sep 2012, 20:19 by L18L
ppm
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


Posted on 27 Sep 2012, 8:05 by BarryK
Updating .desktop
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



Posted on 27 Sep 2012, 8:54 by BarryK
Re PACKAGE and CATEGORY
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



Posted on 2 Oct 2012, 2:26 by L18L
pinstall.sh in langpack
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.
Barry, see my post at forum http://www.murga-linux.com/puppy/viewtopic.php?p=655552 please.




Posted on 3 Oct 2012, 24:35 by rodin.s
New pinstall.sh doesn't work
New pinstall.sh doesn't work here. I have replaced old pinstall.sh with new one and menu is not translated while installing package. Maybe some entries are translated but not all and 'desktop-directories' are not translated at all. So I put back old one which works.


Posted on 11 Oct 2012, 7:33 by BarryK
Re: new pinstall.sh doesn't work
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.



Posted on 11 Oct 2012, 8:05 by BarryK
langpack hacks script
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.



Posted on 12 Oct 2012, 22:00 by L18L
re: langpack hacks script
Thank you.

Okay, so I will use relative paths.