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:
#!/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:
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:
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:
if [ "LANG1" != "en" ]; then #translate package descriptions
INPUTFILE=/tmp/filterpkgs.results.post
. /usr/local/petget/translatedescr.sh
fi #package descriptions translated
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum