Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 16 Sep 2014, 15:47
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects » Localization Project
translate package descriptions using momanager
Moderators: Lobster, MU, raffy
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sun 15 Apr 2012, 12:11    Post subject:  translate package descriptions using momanager  

-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:
#!/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:
momanager


Have fun

-----------------------------------
edited
Note, do NOT use this if you have
Puppy Package Manager (dotpup/petget) i18n
-----------------------------------
frog_eats_fly.png
 Description   Note:
some descriptions have been translated
(marked red)
 Filesize   26.5 KB
 Viewed   491 Time(s)

frog_eats_fly.png

momanager.gz
Description  save as /usr/sbin/momanager
chmod +x /usr/sbin/momanager
gz

 Download 
Filename  momanager.gz 
Filesize  93.18 KB 
Downloaded  334 Time(s) 

Last edited by L18L on Thu 26 Apr 2012, 04:30; edited 2 times in total
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Wed 25 Apr 2012, 13:57    Post subject: translated package descriptions
Subject description: change petget
 

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
to /usr/local/petget/filterpkgs.sh

That´s it
Have fun
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Jump to:  

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


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0523s ][ Queries: 13 (0.0075s) ][ GZIP on ]