translate package descriptions using momanager

For efforts in internationalising Puppy and solving problems in this area
Post Reply
Message
Author
User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

translate package descriptions using momanager

#1 Post by L18L »

-Save attached script as /usr/sbin/momanager (without .gz), make sure it is executable.

-Put the following into an executable script named package_descr.sh located in /usr/local/petget:

Code: Select all

#!/bin/sh
#this is /usr/local/petget/package_descr.sh
# 2012-04-15 L18L
export TEXTDOMAIN=package_descr # identifier for momanager
dummy="$(gettext 'no description available')" # needed everywhere
#
-start momanager

Code: Select all

momanager
Have fun

-----------------------------------
edited
Note, do NOT use this if you have
Puppy Package Manager (dotpup/petget) i18n
-----------------------------------
Attachments
frog_eats_fly.png
Note:
some descriptions have been translated
(marked red)
(26.5 KiB) Downloaded 671 times
momanager.gz
save as /usr/sbin/momanager
chmod +x /usr/sbin/momanager
(93.18 KiB) Downloaded 649 times
Last edited by L18L on Thu 26 Apr 2012, 08:30, edited 2 times in total.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

translated package descriptions

#2 Post by L18L »

To make use of your translated package descriptions in Puppy Package Manager do the following steps:

1- copy the following code into a new executable script named /usr/local/petget/translatedescr.sh

Code: Select all

#!/bin/sh
#2012 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html).
#translates package descriptions in INPUTFILE
#INPUTFILE is set in calling script
#called from filterpkgs.sh, INPUTFILE=/tmp/filterpkgs.results.post
#called from finduserinstalledpkgs.sh INPUTFILE=/tmp/installedpkgs.results

#ex:
#msgid "A GNU archiving program"
#msgstr "Ein GNU-Archivierungsprogramm"

TEXTDOMAIN=package_descr 
export TEXTDOMAIN

if [ "`gettext \"no description available\"`" != "no description available" ];
then # only if this message was translated in TEXTDOMAIN
 mv $INPUTFILE  ${INPUTFILE}.tmp
 while read LINE
 do
  pckgNAME="`echo -n "$LINE" | cut -f 1 -d '|'`"
  pckgDESC="`echo -n "$LINE" | cut -f 2 -d '|'`" #ex:"A GNU archiving program"
  [ "$pckgDESC" = "" ] && pckgDESC="`gettext \"no description available\"`"
  pckgDESC_LANG="`gettext \"${pckgDESC}\"`" #ex:"Ein GNU-Archivierungsprogramm"
  echo -e "${pckgNAME}|${pckgDESC_LANG}" >> $INPUTFILE
 done < ${INPUTFILE}.tmp
 rm -f ${INPUTFILE}.tmp
fi
2- edit /usr/local/petget/installpreview, insert

Code: Select all

if [ "LANG1" != "en" ]; then  #translate package description
 export TEXTDOMAIN=package_descr 
 DB_description="`gettext \"${DB_description}\"`"
 export TEXTDOMAIN=petget___installpreview.sh
fi #package descriptions translated
after
DB_description="`echo -n "$DB_ENTRY" | cut -f 10 -d '|'`"

3- append

Code: Select all

if [ "LANG1" != "en" ]; then  #translate package descriptions
 INPUTFILE=/tmp/installedpkgs.results
 . /usr/local/petget/translatedescr.sh
fi #package descriptions translated
to /usr/local/petget/finduserinstalledpkgs.sh

4- append

Code: Select all

if [ "LANG1" != "en" ]; then  #translate package descriptions
 INPUTFILE=/tmp/filterpkgs.results.post
 . /usr/local/petget/translatedescr.sh
fi  #package descriptions translated
to /usr/local/petget/filterpkgs.sh

That´s it
Have fun

Post Reply