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 Fri 31 Oct 2014, 04:34
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 Posts_count  
Author Message
L18L

Joined: 19 Jun 2010
Posts: 2536
Location: Moved from Hosla to www.eussenheim.de

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   512 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  345 Time(s) 

Edited_times_total
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2536
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Wed 25 Apr 2012, 13:57    Post_subject: translated package descriptions
Sub_title: 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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0565s ][ Queries: 12 (0.0109s) ][ GZIP on ]