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 Thu 23 Oct 2014, 04:56
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Langpacks e LiveCD in italiano
Moderators: Lobster, MU, raffy
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 4 [57 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sun 13 Jul 2014, 08:28    Post subject:  

Ultimo e definitivo aggiornamento dei langpacks. Very Happy
Inserito Networ Wizard composto da:
rc.network
ndiswrapperGUI.sh
wag-profiles.sh
net-setup.sh
Conclusa la fase di betatest ora inizia la fase di mantenimento.
Segnalate gli errori eventualmente trovati. Wink
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Wed 16 Jul 2014, 12:32    Post subject:  

Pdisk e Didiwiki localizzati con gettext
Pdisk and Didiwiki localized with gettext

pdisk:

Code:
#!/bin/sh
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#v3.97 BK bugfix.
#110205 use probedisk2.
#130203 change probedisk2 to probedisk.

ver="xxx"
export TEXTDOMAIN=Pdisk
export OUTPUT_CHARSET=UTF-8

if [ -f /usr/sbin/cfdisk -o -f /sbin/cfdisk ];then #v3.97
 BUTMANAGE="fdisk:20,cfdisk:21"
else
 BUTMANAGE="fdisk:20"
fi

ALLINFO="`probedisk 2>/dev/null | grep -v "optical|" | grep -v "/scd"`" #110205
ALLPARTS="`echo "$ALLINFO" | cut -f 1 -d "|" | cut -f 3 -d "/" | tr "\n" " "`"
ALLMNTD="`df | grep "/dev/" | cut -f 1 -d " " | grep -v "loop" | tr "\n" " "`"

butval=20
BUTPARTS=""
for EACHPART in $ALLPARTS
do
BUTPARTS="${BUTPARTS}$EACHPART:$butval,"
butval=`expr $butval + 1`
done
BUTPARTS="${BUTPARTS}$(gettext EXIT:)10"

xmessage -bg "#8080ff" -center -name "Pdisk" -title "Pdisk drive partition manager" -buttons $BUTPARTS "$(gettext 'Welcome, this program enables you to run either fdisk, or, if it is
installed, cfdisk. These are utility applications to examine and
modify disk drive partitions. This includes creating and erasing
partitions, so is not for the faint-of-heart!')

$(gettext 'Here are the disk drives that Puppy knows about:')
$ALLINFO

$(gettext 'If any drive is wrong or missing, exit this program and run the
\Mount/unmount drives\ program, that you will find in the \File
Managers\ menu. That tool will enable you to probe the hardware.')

$(gettext 'These partitions are curently mounted:')
$ALLMNTD
$(gettext '...you can view these but NOT change them.')

$(gettext 'To continue this program, click a drive button...')"

RETVAL=$?
if [ $RETVAL -lt 11 ];then
 exit
fi

EDITPART="`echo "$BUTPARTS" | tr "," "\n" | grep "$RETVAL" | cut -f 1 -d ":"`"

xmessage -bg "#80C080" -center -name "Pdisk" -title $(gettext "Pdisk drive partition manager") -buttons $BUTMANAGE,EXIT:10 $(gettext  "Chose the partition manager program that you want to use...")

RETVAL=$?
if [ $RETVAL -lt 11 ];then
 exit
fi

if [ $RETVAL -eq 21 ];then
 rxvt -bg "#C080ff" -e cfdisk /dev/$EDITPART
else
 rxvt -bg "#C080ff" -e fdisk /dev/$EDITPART
fi


didiwiki-gui

Code:
#! /bin/sh

# this starts/stops DidiWiki server
# ASSUMES A USER NAMED spot HAS BEEN SETUP
# GuestToo - Feb 7, 2005. Hacked a bit by BK -- 2005,2006.
# Designed for use with Puppy Linux, www.puppylinux.com
#v411 dunno why, but no longer creates new pages, needs /root/spot/.didiwiki world-writable.

#v411 bug workaround, needs to be fixed properly sometime...

ver="412"
export TEXTDOMAIN=didiwiki-gui
export OUTPUT_CHARSET=UTF-8

mkdir -p /root/spot/.didiwiki
chmod 777 /root/spot/.didiwiki

DIDI="/root/spot/didiwiki"

if ! MSG=`which gxmessage`
then
 MSG='xmessage'
fi

if ! grep spot /etc/group
then
 $MSG -center -bg "#ffc0c0" -title  "DidiWiki" $(gettext 'No user /spot/')
 exit 1
fi

if [ ! -r $DIDI ];then
 DIDI=`which didiwiki`
fi

if [ ! -r $DIDI ];then
 $MSG -center -bg "#ffc0c0" -title  "DidiWiki" $(gettext 'DidiWiki program not found')
 exit 1
fi

#BK
PSSTATUS="`ps`"
if [ "`echo -n "$PSSTATUS" | grep 'didiwiki' | grep -v 'didiwiki\-gui'`" = "" ];then
 BUTTONS1="$(gettext Start:)21,$(gettext Cancel:)10"
 MSG1=$(gettext "Click Start button to start DidiWiki
server and launch browser.
Note that DidiWiki runs as user \"spot\"")
 DIDIGO="no"
else
 BUTTONS1="Start:21,Stop:22,Cancel:10"
 MSG1=$(gettext "DidiWiki server is already running, as user \"spot\".
Click Start button to open web browser and use DidiWiki,
or Stop button if you want to kill the server")
 DIDIGO="yes"
fi

$MSG -center -buttons "$BUTTONS1" -title "DidiWiki" "$MSG1"
case $? in

21)
RETVAL1=0
if [ "$DIDIGO" = "no" ];then
 su -c $DIDI - spot &
 #note, .didiwiki folder is created in /root/spot/.
 RETVAL1=$?
fi
if [ $RETVAL1 -eq 0 ];then
 ##hv3 seems to work fine...
 #if [ "`which hv3`" = "" ];then
 # defaultbrowser http://localhost:8000/
 #else
 # hv3 http://localhost:8000/
 #fi
 defaulthtmlviewer http://localhost:8000/
else
 $MSG -center -bg "#ffc0c0" -title  "DidiWiki" $(gettext 'ERROR: DidiWiki did NOT start')
fi
;;

22)
killall -3 didiwiki
sleep 1
killall -9 didiwiki
ps | grep didiwiki
if [ $? -eq 0 ];then
 $MSG -center -bg "#d0ffd0" -title  "DidiWiki" $(gettext 'DidiWiki is stopped')
else
 $MSG -center -bg "#ffc0c0" -title  "DidiWiki" $(gettext 'DidiWiki is still running')
fi
;;

*) exit ;;

esac
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Thu 17 Jul 2014, 02:50    Post subject:  

Soluzione di L18L al 'right-click'
L18L solution to 'right-click'

Code:
#!/bin/sh
# /usr/sbin/fixroxOpenWith
# L18L July 2014 GPL
# make link text translatable
# based upon xanad's suggestion,
# see http://www.murga-linux.com/puppy/viewtopic.php?t=76368&start=123

export TEXTDOMAIN=fixroxOpenWith

cd /root/.config/rox.sourceforge.net/OpenWith

for DATA in "Pfind|.inode_directory|$(gettext 'Search with Pfind')" "pburn|.application_x-cd-image|$(gettext 'Burn with Pburn')" "Backgrounds|.image_gif|$(gettext 'Send-to Backgrounds')" "Backgrounds|.image_jpeg|$(gettext 'Send-to Backgrounds')" "Backgrounds|.image_png|$(gettext 'Send-to Backgrounds')"
do
 APP="`echo $DATA | cut -d'|' -f1`"
 DIR="`echo $DATA | cut -d'|' -f2`"
 LNK="`echo $DATA | cut -d'|' -f3`"
 oldLINK="`ls --full-time $DIR | grep $APP | cut -d' ' -f9- | cut -d'>' -f1 | rev | cut -c3- | rev`" #ex:Copia in Backgrounds
 [ "$oldLINK" != "$LNK" ] && mv "${DIR}/${oldLINK}" "${DIR}"/"${LNK}"
done

cd - >/dev/null

Last edited by xanad on Fri 18 Jul 2014, 07:33; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Fri 18 Jul 2014, 03:53    Post subject:  

Soluzione dimenticanza gettext in 'menumanager', mancano le stringhe all'inizio del file:
Resolution forgetfulness gettext parameters in 'menumanager', missing strings beginning of the file:

Code:
export TEXTDOMAIN=menumanager
export OUTPUT_CHARSET=UTF-8


File OK:

Code:

#!/bin/bash

# 131222 01micko, script to manage what .desktop files show in menu
# must be run as root

[ "$UID" = 0 ]|| exec sudo -A ${0} ${@}

export TEXTDOMAIN=menumanager
export OUTPUT_CHARSET=UTF-8

CWM=`cat /etc/windowmanager`
JWM_MENU_HEIGHT=
if [ "$CWM" = "jwm" ];then
  MENHEIGHT=16
  [ -f $HOME/.jwm/menuheights ] && . $HOME/.jwm/menuheights
  MENU=`grep "RootMenu label" /etc/xdg/templates/_root_.jwmrc|grep MENHEIGHT`
 [ "$MENU" ] && JWM_MENU_HEIGHT='<frame '$(gettext "Menu Heights")'>
      <hbox space-fill="true" space-expand="true">
        <text space-expand="false" space-fill="false"><label>" "</label></text>
        <text wrap="false" xalign="0" space-expand="true" space-fill="true"><label>'$(gettext "You can adjust the heights of the menus in pixels :")'   </label></text>
        <spinbutton range-min="16" range-max="48" range-step="8" editable="false" space-expand="false" space-fill="false">
          <variable>NEWMENHEIGHT</variable>
          <default>'$MENHEIGHT'</default>
          <sensitive>true</sensitive>
        </spinbutton>
      </hbox>
    </frame>'
fi

tmp=${RANDOM}
export TMP0=/tmp/${tmp}0
export TMP1=/tmp/${tmp}1
export TMP2=/tmp/${tmp}2
export DIR=/usr/share/applications

# potential shown list(s)
grep -E "^Icon=" ${DIR}/* | awk -F: '{print $1}' > $TMP0

# enabled list
echo -n '' > $TMP1
while read fline
  do
    grep -q -E "^NoDisplay=" $fline
    case $? in
      0)FALSE=`grep -E "^NoDisplay=" $fline | grep "false"`
      [ "$FALSE" ] && echo ${fline##*/} >> $TMP1
      ;;
      *)echo ${fline##*/} >> $TMP1
      ;;
     esac
  done < $TMP0

# disabled list
echo -n '' > $TMP2
while read tline
  do
    grep -q -E "^NoDisplay=true" $tline
    [ "$?" -eq 0 ] && echo ${tline##*/} >> $TMP2
  done < $TMP0

func_msg(){
   gtkdialog-splash -timeout $5 -bg $6 -close $7 -text "$1 $2 $3 $4."
}
export -f func_msg

#loop used for multiple selections when holding ctrl when clicking
# move to disabled
move_right() {
   if [ "$YLIST" != "" ];then
     for Y in $YLIST
     do
      grep -q $Y $TMP2
      if [ $? != 0 ];then
       func_msg Removing "$Y" from menu. 1 orange box
       echo $Y >> $TMP2
        sed -i "/$Y/d" $TMP1
      fi
     done
   fi
   return
}
export -f move_right

# move to enabled
move_left() {
   if [ "$NLIST" != "" ];then
     for N in $NLIST
     do
      grep -q $N $TMP1
      if [ $? != 0 ];then
       func_msg enabling "$N" at startup. 1 green box
       echo $N >> $TMP1
       sed -i "/$N/d" $TMP2
      fi
     done
   fi
   return
}
export -f move_left

export menuManager='
<window title="'$(gettext "Menu Manager")'" icon-name="gtk-properties">
<vbox space-fill="true" space-expand="true">
  '"`/usr/lib/gtkdialog/xml_info fixed menu.svg 60 "$(gettext "This application controls what apps are set to show in the menu on your system.")"`"'
  <frame '$(gettext "Currently Menu Items")'>
      <vbox border-width="10" space-expand="false" space-fill="false">
        <text wrap="false" xalign="0" use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext "<b>Remove</b> an app from the menu by highlighting in the left pane and pressing <b>−</b>.")'"</label></text>
        <text wrap="false" xalign="0" use-markup="true" space-expand="false" space-fill="false"><label>"'$(gettext "<b>Add</b> an app to the menu by highlighting in the right pane and pressing <b>+</b>.")'"</label></text>
      </vbox>
     <hbox height-request="146" space-fill="true" space-expand="true">
       <hbox space-fill="true" space-expand="true">
         <tree selection-mode="3">
           <variable>YLIST</variable>
           <label>'$(gettext "Enabled Menu Items")'</label>
           <input>cat '"$TMP1"'</input>
         </tree>
       </hbox>
       <vbox homogeneous="true" space-fill="false" space-expand="false">
         <vbox space-fill="false" space-expand="false">
           <button border-width="3">
             '"`/usr/lib/gtkdialog/xml_button-icon remove`"'
             <action>move_right</action>
             <action>refresh:YLIST</action>
             <action>refresh:NLIST</action>
           </button>
           <button border-width="3">
             '"`/usr/lib/gtkdialog/xml_button-icon add`"'
             <action>move_left</action>
             <action>refresh:YLIST</action>
             <action>refresh:NLIST</action>
           </button>
         </vbox>
       </vbox>
     <tree selection-mode="3">
       <variable>NLIST</variable>
         <label>'$(gettext "Disabled Menu Items")'</label>
         <input>cat '"$TMP2"'</input>
     </tree>
   </hbox>
  </frame>
  '$JWM_MENU_HEIGHT'
 <hbox space-expand="false" space-fill="false">
    <button space-expand="false" space-fill="false">
      <label>'$(gettext "Cancel")'</label>
      '"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
      <action>exit:Cancel</action>
    </button>
    <button space-expand="false" space-fill="false">
      <label>'$(gettext "Ok")'</label>
      '"`/usr/lib/gtkdialog/xml_button-icon ok`"'
      <action>exit:OK</action>
    </button>
  </hbox>
 </vbox>
</window>'

. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
eval $(gtkdialog -p menuManager)

case $EXIT in
OK)
# add to enabled
while read line1; do
 [ -f ${DIR}/${line1} ] && \
 sed -i "s%NoDisplay=true%NoDisplay=false%" ${DIR}/${line1}
 done < $TMP1
# add to disabled
while read line2; do
 [ -f ${DIR}/${line2} ] && \
 grep -q "^NoDisplay=" ${DIR}/${line2}
  if [ "$?" -eq 0 ];then
   sed -i "s%NoDisplay=false%NoDisplay=true%" ${DIR}/${line2}
  else
   echo "NoDisplay=true" >> ${DIR}/${line2}
  fi
 done < $TMP2
# menu heights
if [ "$NEWMENHEIGHT" != "$MENHEIGHT" ];then
  if [ "$NEWMENHEIGHT" = 16 ];then
    [ -f $HOME/.jwm/menuheights ] && rm $HOME/.jwm/menuheights
  else
    echo "MENHEIGHT=$NEWMENHEIGHT" > $HOME/.jwm/menuheights
  fi
fi
# fix menu
func_msg Please wait .. .   2 pink never &
pid=$!
fixmenus
ps -A | grep -q "jwm" && (jwm -reload || jwm -restart)
kill -9 $pid
rm $TMP0; rm $TMP1; rm $TMP2
sleep 1;;
*)rm $TMP0; rm $TMP1; rm $TMP2;;
esac
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sat 19 Jul 2014, 11:51    Post subject:  

Inserimento in prima pagina del langpack italiano della versione sperimentale di Slacko 593 di 01micko.
Italian langpack for Slacko 593 beta version (01micko) in first page,
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sun 20 Jul 2014, 05:15    Post subject:  

inserimento gettext in 'gparted_shell'
edit 'gparted_shell' with gettext

Code:
#!/bin/sh
#(c) copyright 2008 Barry Kauler
#2008 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#v411 BK: wrapper for gparted, prevent indefinite scan at startup on some systems.
#v424 update desktop drive icons. note, this is also done in /usr/sbin/bootflash, puppyinstaller.
#v424 report that gparted crash with a non-english locale.
#111013 remove LANG=C
#130118 rodin.s: add gettext.
#130722 new method to signal to update desktop drive icons.

export TEXTDOMAIN=gparted_shell
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8
. gettext.sh
export LANGORG=$LANG

#v424 report that gparted crash with a non-english locale. well, maybe just do this...
#export LANG=C # off for gettext, hope it won't crash

echo -n "" > /tmp/gparted_shell_probe
PROBEDISK="`probedisk2 | grep -v '|optical|'`"
echo "$PROBEDISK" |
while read ONEPROBE
do
 ONEDRIVE="`echo -n "$ONEPROBE" | cut -f 1 -d '|' | cut -f 3 -d '/'`"
 ONECATEG="`echo -n "$ONEPROBE" | cut -f 2 -d '|'`"
 case $ONECATEG in
  drive) ONECATEG="$(gettext 'internal drive')";;
  usbdrv) ONECATEG="$(gettext 'USB drive')";;
 esac
 ONEDESCR="`echo -n "$ONEPROBE" | cut -f 3 -d '|' | tr '\"' ' '`"
 echo "<radiobutton><label>${ONEDRIVE} ${ONECATEG}. $(gettext 'Descr:') ${ONEDESCR}</label><variable>RADIO_${ONEDRIVE}</variable></radiobutton>" >> /tmp/gparted_shell_probe
done

 echo "<radiobutton><label>$(gettext 'ALL DRIVES. Scan all drives at startup')</label><variable>RADIO_all</variable></radiobutton>" >> /tmp/gparted_shell_probe
 
DRVTAGS="`cat /tmp/gparted_shell_probe`"

export MAIN_DIALOG="
<window title=\"Gparted\">
 <vbox>
  <text><label>$(gettext 'Welcome, Gparted is an application to examine and modify partitions in a disk drive. At startup, the default behaviour is for Gparted to scan for all drives in the computer, and on some computers this can take a very long time. Therefore, this dialog window enables you to make a choice of which drive you want to work on (and Gparted will only scan that drive at startup).')</label></text>
  <text><label>`gettext \"WARNING: A PC may have a single VFAT or NTFS partition, with Windows installed, and you might want to decrease the size of that partition so as to be able to create a Linux partition. For Windows XP/98/95 this is usually ok (but be careful not to make it too small, say 5GB for XP). However, Vista gets very upset if the partition is resized and may not work properly afterward (in some cases won't even start) -- there may be a fix for this, but we don't know what it is.\"`</label></text>
 
  ${DRVTAGS}
 
  <hbox>
   <button>
    <label>$(gettext 'OKAY')</label>
    <action type=\"exit\">OKAYBUTTON</action>
   </button>
   <button>
    <label>$(gettext 'CANCEL')</label>
    <action type=\"exit\">CANCELBUTTON</action>
   </button>
  </hbox>

 </vbox>
</window>
"

RETVALS="`gtkdialog3 --program=MAIN_DIALOG`"

[ "`echo "$RETVALS" | grep 'OKAYBUTTON'`" = "" ] && exit

THEDRIVE="`echo "$RETVALS" | grep '"true"' | cut -f 1 -d '=' | sed -e 's/RADIO_//'`"

[ "$THEDRIVE" = "all" ] && exec gparted

#v424 record state...
tdPATTERN="/dev/${THEDRIVE}"
DRVSTATE1="`probepart | grep "$tdPATTERN"`"

gparted /dev/${THEDRIVE}

#v424 update desktop drive icons. note, this is also done in /usr/sbin/bootflash, puppyinstaller...
#/tmp/pup_event_frontend_block_request is used in /sbin/pup_event_frontend_d to refresh drv...
DRVSTATE2="`probepart | grep "$tdPATTERN"`"
if [ "$DRVSTATE1" != "$DRVSTATE2" ];then
 sync
 #130722 this file was read by the old /sbin/pup_event_frontend_d big script...
 #echo "$THEDRIVE" > /tmp/pup_event_frontend_block_request
 #now have a binary daemon, send this uevent to it, then /usr/local/pup_event/frontend_change will be called...
 echo change > /sys/block/${THEDRIVE}/uevent
fi

###END###
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Mon 21 Jul 2014, 09:20    Post subject:  

gettext in 'wirelesswizard'

Code:
#!/bin/sh
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#wizard to setup wireless

export TEXTDOMAIN=wirelesswizard
export OUTPUT_CHARSET=UTF-8

BUTTONS="$(gettext Setup_ndiswrapper:)10,$(gettext Run_WAG:)11,$(gettext EXIT:)19"

if [ "`which perl`" ];then
 MSG01="$(gettext 'GOOD: It seems that Perl is available, and Perl is needed to install the
      Windows driver for the wireless card. You now have three choices:

CHOICE 1: ndiswrapper
Note that Perl is only required during installation of the driver.
Okay, that is one requirement out of two! Now, do you have the CD that came with
the wireless card? If so, click the \"Setup_ndiswrapper\" button...

CHOICE 2: wifi-beta.pup
If you do not have the XP driver for the card, Bladehunter (Forum name) has
developed wifi-beta.pup, a DotPup package that enables you to use ndiswrapper
without requiring Perl. But, it only works for certain wifi cards. Find out more
and to download, go to the Announcements section of the Puppy Forum. Download
it, install it (it is a DotPup package, so after downloading it, you just click
on it to install it), then run this Wizard again.
Please click \"EXIT\" button if wifi-beta.pup not installed...
Please click \"Run_WAG\" button if wifi-beta.pup is installed...

CHOICE 3: Use a Linux driver
Many wifi cards have a Linux driver module and some are installed in Puppy, and
more can be found if you go to the Announcements section of the Puppy Forum.
Quit this Wizard, install a driver, load it with modprobe, then run this Wizard.
Please click \"EXIT\" button only...')"
else
 MSG01="$(gettext 'BAD: ndiswrapper needs Perl to install the Windows card driver,
     and Perl is not installed in Puppy. You now have three choices:

CHOICE 1: Install Perl via usr_devx.sfs
Click the \"EXIT\" button to quit this script. You must install Perl first, before
running this Wizard. It is easy to do: just download usr_devx.sfs, that you will
find via the Puppy download page (one day I will get this script to do it!),
download it to /mnt/home (unless /mnt/home is a NTFS partition, then you have to
boot Windows and download it to C: drive). Or, if you have a full hard drive
installation of Puppy (Option-2) then place usr_devx.sfs at /. After downloading
usr_devx.sfs, reboot Puppy, then run this Wireless Wizard again.
Note 1: Perl is only required during installation of the card driver.
Note 2: usr_devx.sfs is 43M so if on dialup you may want CHOICE 1b, 2 or 3.
Please click \"EXIT\" button only...

CHOICE 1b: Install Perl via PupGet
As above, but there is a Perl PupGet package, that is only a 924K download.
Choose this if on dialup, or not interested in the compiling tools provided by
usr_devx.sfs. After installing the wireless driver, Perl may be uninstalled.
Please click \"EXIT\" button only...

CHOICE 2: Install wifi-beta.pup
This is a package developed by Bladehunter (Forum name) that enables you to use
ndiswrapper without requiring Perl at all. This works for certain wireless cards
only -- go to the Announcements section of the Puppy Forum for more information
and a download link. Download it, install it (it is a DotPup package, so after
downloading it, you just click on it to install it), then run this Wizard again.
Please click \"EXIT\" button if wifi-beta.pup not installed...
Click \"Run_WAG\" button if wifi-beta.pup installed...

CHOICE 3: Use a Linux driver
Many wifi cards have a Linux driver module and some are installed in Puppy, and
more can be found if you go to the Announcements section of the Puppy Forum.
Quit this Wizard, install a driver, load it with modprobe, then run this Wizard
and click on \"Run_WAG\" button.
Please click \"EXIT\" button only...')"
fi

if [ "`iwconfig | grep "Signal level"`" = "" ];then
 #BUTTONS="Setup_ndiswrapper:10,EXIT:19"
 MSG11="$MSG01"
else
 #BUTTONS="Run_WAG:11,EXIT:19"
 MSG11="$(gettext 'VERY GOOD:
It seems that you already have a working wireless interface, so go ahead and
click on the \"Run_WAG\" button to establish connectivity with a wireless
network. WAG is an acronym for Wireless Access Gadget and is a brilliant
program developed by keenerd (Forum name).

Click the \Run_WAG\ button now...')"
fi

 xmessage -bg "light yellow" -center -name "wirelesswizard" -title "$(gettext 'wirelesswizard: Welcome')" -buttons "$BUTTONS" "$(gettext 'Welcome to the Puppy Wireless Networking Wizard!
NOTE: if you have a physical Ethernet cable plugged into your PC, this is the
      wrong Wizard! Click \EXIT\ button, and run the Ethernet Wizard....')

$MSG11
"

case ${?} in
 10)
  echo "ndiswrapper"
  ;;
 11)
  exec /usr/sbin/wag
  ;;
 *)
  exit
  ;;
esac

#ndiswrapper setup...
xmessage -bg "light yellow" -center -name "wirelesswizard" -title "$(gettext 'wirelesswizard: Ndiswrapper')" -buttons "Run_WAG:10,EXIT:19" "$(gettext 'Early days with this Wizard. For now the ndiswrapper setup is manual.

Follow these instructions, write them down if necessary.
If the ndiswrapper does not work, which is possible, you will need to find
a specific Linux driver for your wireless card. Look on the Forum and Wiki
for further information on that.
Here are the steps:

1. Mount the CD supplied with the wireless card.
2. Open a terminal in the XP drivers folder on the CD. Then type these:
3. # ndiswrapper -i drivername.inf        ...this creates /etc/ndiswrapper/
   (substitute the actual .inf filename for drivername.inf)
4. # ndiswrapper -l                  ...this tests status of installed driver.
   (that is the letter l, not the numerical 1)
5. # modprobe ndiswrapper            ...this loads the module
6. # iwconfig                        ...tests if interface available

After Step 6, if it does look like you have a functioning wireless interface,
go ahead and click the \"Run_WAG\" button...
If one of the steps failed, click \EXIT\ button...')"

case ${?} in
 10)
  exec /usr/sbin/wag
  ;;
 *)
  exit
  ;;
esac


###END###
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sat 26 Jul 2014, 06:49    Post subject:  

gettext in 'desksetup.sh'

Code:
#!/bin/sh
#copyright 01micko 2011
#GPL3 see /usr/share/doc/legal/
#NO warranty
# simple prog to arrange desk icons
ver="0.8" #120531
#is rox running?
ROXRUNNING=`ps|grep "/usr/local/apps/ROX-Filer/ROX-Filer -p /root/Choices/ROX-Filer/PuppyPin"|grep -v "grep"`
[ "$ROXRUNNING" = "" ]&& gtkdialog-splash  -icon gtk-dialog-error -timeout 5 -deco deskset -fontsize large -bg hotpink -close never -text "ERROR: Rox pinboard is not running. You can't use this application" && exit
#eventmanager has a bug where pristine it has double quotes arround bool statements, after evenmanager is run they disappear
HASQUOTES=`grep '"' /etc/eventmanager`
if [[ "$HASQUOTES" != "" ]];then #110120
 sed -i 's/\"//g' /etc/eventmanager
fi
. /etc/eventmanager
#get radio defaults for drive icons from /etc/eventmanager
if [[ "$ICONDESK" = "false" && "$ICONPARTITIONS" = "true" ]];then
 RADIO6=true
 RADIO7=false
 RADIO8=false
 RADIO9=false
 elif [[ "$ICONDESK" = "true" && "$ICONPARTITIONS" = "true" ]];then
  RADIO6=false
  RADIO7=true
  RADIO8=false
  RADIO9=false
 elif [[ "$ICONDESK" = "true" && "$ICONPARTITIONS" = "false" ]];then
  RADIO6=false
  RADIO7=false
  RADIO8=true
  RADIO9=false
 elif [[ "$ICONDESK" = "false" && "$ICONPARTITIONS" = "false" ]];then
  RADIO6=false
  RADIO7=false
  RADIO8=false
  RADIO9=true
fi
#define working directorys
APPDIR="`dirname $0`"
[ "$APPDIR" = "." ] && APPDIR="`pwd`"
export APPDIR="$APPDIR"
#define config dir/file
CONFDIR="$HOME/.desksetup"
CONFFILE="$CONFDIR/desk.conf"
#export $CONFFILE
cp -af $CONFFILE ${CONFFILE}.bak
. $CONFFILE
PIXMAPDIR="/usr/local/lib/X11/mini-icons"
#gui

export TEXTDOMAIN=desksetup
export OUTPUT_CHARSET=UTF-8

export deskset="<window title=\"$(gettext 'Desktop Setup') $ver\"  icon-name=\"gtk-preferences\">
 <vbox>
  <notebook labels=\"$(gettext 'Desk Icons|Drive Icons')\">
   <vbox>
   <pixmap>
    <input file>$PIXMAPDIR/mini-desktop.xpm</input>
   </pixmap>
   <text use-markup=\"true\"><label>\"$(gettext '<b>Choose a desktop layout</b>')\"</label></text>
   <radiobutton tooltip-text=\"$(gettext 'This is the standard Puppy desktop that has been a tradition since Barry Kauler started Puppy in 2003, for purists')\">
   <label>\"$(gettext 'Traditional -full desktop icons')\"</label>
   <variable>RADIO1</variable>
   <action>if true sed -i 's/RADIO1=[a-z]*[a-z]/RADIO1=true/' $CONFFILE</action>
   <action>if false sed -i 's/RADIO1=[a-z]*[a-z]/RADIO1=false/' $CONFFILE</action>
   <default>$RADIO1</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'This includes just the file, browse, edit, console and play icons, for those who move fast')\">
   <label>\"$(gettext 'Minimal -essential desktop icons')\"</label>
   <variable>RADIO2</variable>
   <action>if true sed -i 's/RADIO2=[a-z]*[a-z]/RADIO2=true/' $CONFFILE</action>
   <action>if false sed -i 's/RADIO2=[a-z]*[a-z]/RADIO2=false/' $CONFFILE</action>
   <default>$RADIO2</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'There will be no application icons on the desktop, this is for minimalists')\">
   <label>\"$(gettext 'Bare -no desktop icons')\"</label>
   <variable>RADIO3</variable>
   <action>if true sed -i 's/RADIO3=[a-z]*[a-z]/RADIO3=true/' $CONFFILE</action>
   <action>if false sed -i 's/RADIO3=[a-z]*[a-z]/RADIO3=false/' $CONFFILE</action>
   <default>$RADIO3</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'This template is the standard Slacko layout')\">
   <label>\"$(gettext 'Slacko custom icons')\"</label>
   <variable>RADIO4</variable>
   <action>if true sed -i 's/RADIO4=[a-z]*[a-z]/RADIO4=true/' $CONFFILE</action>
   <action>if false sed -i 's/RADIO4=[a-z]*[a-z]/RADIO4=false/' $CONFFILE</action>
   <default>$RADIO4</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'This will display your saved custom pinboard')\">
   <label>\"$(gettext 'Custom -choose your saved profile')\"</label>
   <variable>RADIO5</variable>
   <action>if true sed -i 's/RADIO5=[a-z]*[a-z]/RADIO5=true/' $CONFFILE</action>
   <action>if false sed -i 's/RADIO5=[a-z]*[a-z]/RADIO5=false/' $CONFFILE</action>
   <default>$RADIO5</default>
   </radiobutton>
   <hbox>
   <text><label>$(gettext 'Click this button to save your custom arrangement')</label></text>
   <button tooltip-text=\"$(gettext 'Clicking here will save your desktop changes to a customised file. Be aware that this omits drive icons')\">
    <input file stock=\"gtk-save\"></input>
    <action>. $APPDIR/func customsave</action>
   </button>
   </hbox>
  </vbox>
 
  <vbox>
   <pixmap>
    <input file>$PIXMAPDIR/mini-diskette.xpm</input>
   </pixmap>
   <text use-markup=\"true\"><label>\"<b>$(gettext 'Choose a drive icon layout')</b>\"</label></text>
   <radiobutton tooltip-text=\"$(gettext 'This is for minimalist bare desktops, there will be no drive icons at all')\">
   <label>\"$(gettext 'Clean -no drive icons')\"</label>
   <variable>RADIO6</variable>
   
   <default>$RADIO6</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'This is the default for all puppies, each partition will have its own icon as will plugged drives')\">
   <label>\"$(gettext 'Traditional -an icon for each partition')\"</label>
   <variable>RADIO7</variable>
   
   <default>$RADIO7</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'There will be only the root of the drives on the desktop')\">
   <label>\"$(gettext 'Lean -only root drive icons')\"</label>
   <variable>RADIO8</variable>
   
   <default>$RADIO8</default>
   </radiobutton>
   <radiobutton tooltip-text=\"$(gettext 'There will be only 1 drive icon which starts Pmount')\">
   <label>\"$(gettext 'Minimal -One drive icon')\"</label>
   <variable>RADIO9</variable>
   
   <default>$RADIO9</default>
   </radiobutton>
  </vbox>
 </notebook>
  <hbox homogeneous=\"true\">
   <text use-markup=\"true\"><label>\"$(gettext '<i>When <b>Apply</b> is clicked X will restart</i>')\"</label></text>
  </hbox>
  <hbox>
   <button tooltip-text=\"$(gettext 'Clicking Apply will save your changes and restart the X server. Be sure you have saved all your work')\">
    <input file stock=\"gtk-apply\"></input>
    <label>$(gettext 'Apply')</label>
    <action>. $APPDIR/func apply</action>
    <action>exit:applied</action>
   </button>
   <button>
    <input file stock=\"gtk-quit\"></input>
    <label>$(gettext 'Close')</label>
    <action>cp -af ${CONFFILE}.bak $CONFFILE </action>
    <action>exit:closed</action>
   </button>
  </hbox>
 </vbox>
</window>
"
gtkdialog3 -p deskset -c
unset deskset
#end
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sun 27 Jul 2014, 03:11    Post subject:  

Altro piccolo contributo a Slacko 593
Another little contri

gettext in 'ptheme_gtk'

Code:
#!/bin/sh
#ptheme_gtk - change gtk-theme
#Copyright - GPL 2010,2014
#Sigmund Berglund, Michael Amadio

set -a
TMP="`grep 'gtkrc"' $HOME/.gtkrc-2.0 | awk -F '/gtk-2.0' '{print $1}' | cut -d'"' -f2-`"
ACTIVE_THEME="`basename $TMP`"
echo -n > /tmp/ptheme_gtkfont

#functions
set_theme (){
   exec switch2 -f "$FONT" "/usr/share/themes/$THEME"

   #make Qt4 apps theme match gtk2...
   #see also /etc/profile.d/pup_gtk and /root/.config/Trolltech.conf
   THEREBEFORE="$(grep '^gtk-theme-name' /root/.gtkrc-2.0)"
   if [ "$THEREBEFORE" = "" ]; then
      echo "gtk-theme-name=\"${THEME}\"" >> /root/.gtkrc-2.0
      #gtk3 theme support thunor http://murga-linux.com/puppy/viewtopic.php?p=695722#695722
      pathGTK3THEME="`find /usr/share/themes/${THEME} -type d -name gtk-3.0`"
      if [ "$pathGTK3THEME" ]; then #XDG_CONFIG_HOME=/root/.config
         #130404 link to actual theme...
         ln -snf "$pathGTK3THEME" ${XDG_CONFIG_HOME}/gtk-3.0
      fi
   fi
}

set_font (){
   Xdialog --fontsel 0 0 0 2> /tmp/ptheme_gtkfont
}

#parameters
while [ $# != 0 ]; do
   I=1
   while [ $I -le `echo $# | wc -c` ]; do
      case $1 in
         -t) export THEME="$2"; shift;;
         -f) export FONT="$2"; shift;;
         -h|--help)
echo 'Usage: ptheme_gtk [OPTIONS]

Options
  -f FONT     Set font for theme
  -t THEME    Set theme without open gui
  -h          Show this help message'; exit;;
      esac
      shift
      I=$[$I+1]
   done
done
if [ "$THEME" ]; then
   set_theme
   exit
fi

#build list
ls -1A /usr/share/themes > /tmp/ptheme_gtkthemes
while read I; do ITEMS="$ITEMS<item>$I</item>"; done < /tmp/ptheme_gtkthemes
export TEXTDOMAIN=ptheme_gtk
export OUTPUT_CHARSET=UTF-8
pThemeGTK='
<window title="GTK '$(gettext 'theme switcher')'" icon-name="gtk-preferences">
<vbox space-expand="true" space-fill="true">
  '"`/usr/lib/gtkdialog/xml_info fixed "puppy_theme.svg" 60 "$(gettext 'A GTK-theme defines how widgets in programs shows up. This is buttons, lists, fields, and so on. Please apply a theme from the list.')"`"'
  <frame '$(gettext 'Preview')'>
    <menubar>
      <menu>
        <menuitem><label>'$(gettext 'Simple item')'</label></menuitem>
        <menuitem><label>'$(gettext 'Simple item')'</label></menuitem>
        <separator></separator>
        <menuitem icon="gtk-convert"><label>'$(gettext 'With image')'</label></menuitem>
        <menuitem icon="gtk-convert"><label>'$(gettext 'With image')'</label></menuitem>
        <label>'$(gettext 'Menu')'</label>
      </menu>
    </menubar>
    <hbox>
      <checkbox><default>true</default><label>'$(gettext 'Check')' 1</label></checkbox>
      <checkbox><label>'$(gettext 'Check')' 2</label></checkbox>
      <text><label>"  "</label></text>
      <radiobutton><label>'$(gettext 'Radio')' 1</label></radiobutton>
      <radiobutton><label>'$(gettext 'Radio')' 2</label></radiobutton>
      <radiobutton><label>'$(gettext 'Radio')' 3</label></radiobutton>
    </hbox>
    <hbox>
      <button><label>'$(gettext 'Button')'</label><input file stock="gtk-execute"></input></button>
      <text><label>"  "</label></text>
      <checkbox draw_indicator="false"><default>true</default><label>" '$(gettext 'Toggle')' 1 "</label></checkbox>
      <checkbox draw_indicator="false"><label>" '$(gettext 'Toggle')' 2 "</label></checkbox>
      <text><label>"  "</label></text>
      <button><label>'$(gettext 'Disabled')'</label><input file stock="gtk-close"></input><visible>disabled</visible></button>
    </hbox>
    <hbox>
      <progressbar><input>echo 40; echo "(40%)"</input></progressbar>
      <combobox>
       <item>'$(gettext 'item')' A</item>
       <item>'$(gettext 'item')' B</item>
       <item>'$(gettext 'item')' C</item>
      </combobox>
    </hbox>
  </frame>
  <vbox space-expand="true" space-fill="true">
    <frame '$(gettext 'Define Theme')'> 
      <tree rules_hint="true" space-expand="true" space-fill="true">
        <label>'$(gettext 'Themes')'</label>
        <variable>THEME</variable>
        <height>200</height><width>50</width>
        '$ITEMS'
        <action>set_theme</action>
      </tree>
      <hbox>
        <button>
          <label>'$(gettext 'Font')'</label>
          <input file stock="gtk-bold"></input>
          <action>set_font</action>
          <action>refresh:FONT</action>
        </button>
        <entry editable="false">
          <variable>FONT</variable>
          <input>cat /tmp/ptheme_gtkfont</input>
        </entry>
        <button>
          <label>'$(gettext 'Clear')'</label>
          <input file stock="gtk-clear"></input>
          <action>echo > /tmp/ptheme_gtkfont</action>
          <action>refresh:FONT</action>
        </button>
      </hbox>
    </frame>
  </vbox>
  <hbox space-expand="false" space-fill="false">
    <button>
      '"`/usr/lib/gtkdialog/xml_button-icon apply`"'
     <label>'$(gettext 'Apply')'</label>
     <action>set_theme</action>
   </button>
   <button>
     '"`/usr/lib/gtkdialog/xml_button-icon quit`"'
     <label>'$(gettext 'Quit')'</label>
     <action>THEME='$ACTIVE_THEME'; set_theme</action>
     <action>EXIT:cancel</action>
   </button>
   '"`/usr/lib/gtkdialog/xml_scalegrip`"'
  </hbox>
</vbox>
</window>'
. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
gtkdialog -p pThemeGTK 2> /dev/null
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sun 27 Jul 2014, 08:17    Post subject:  

gettext in 'ptheme'

add gettext at line 388, 392, 396 and 400

Code:
#!/bin/bash
#pTheme
#Copyright - GPL 2014
#Sigmund Berglund

IFS=$'\n'
export TEXTDOMAIN=ptheme
export PID_PTHEME=$$

export WORKDIR=/tmp/ptheme
export CONFDIR=/usr/share/ptheme/globals
[ ! -d $WORKDIR ] && mkdir -p $WORKDIR
[ ! -d $CONFDIR ] && mkdir -p $CONFDIR
echo -n > $WORKDIR/save_name
echo -n > $WORKDIR/save_icon
[ ! -d $HOME/.config/ptheme ] && mkdir -p $HOME/.config/ptheme

#build menus
MENUITEMS_ICONS="$(find /usr/local/lib/X11/themes/ -mindepth 1 -maxdepth 1 -type d -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-icons</action><action>refresh:PTHEME_ICONS</action></menuitem>" | sort &)"
MENUITEMS_GTK="$(find /usr/share/themes/ -mindepth 1 -maxdepth 1 -type d -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-gtk</action><action>refresh:PTHEME_GTK</action></menuitem>" | sort &)"
MENUITEMS_JWM_COLOR="$(find $HOME/.jwm/themes/ -mindepth 1 -maxdepth 1 -iname "*jwmrc" -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-jwm</action><action>refresh:PTHEME_JWM_COLOR</action></menuitem>" | sort | sed -e 's/-jwmrc//g' &)"
MENUITEMS_JWM_BUTTONS="$(find /usr/share/pixmaps/jwm_button_themes -mindepth 1 -maxdepth 1 -type d -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-jwm_buttons</action><action>refresh:PTHEME_JWM_BUTTONS</action></menuitem>" | sort &)"
MENUITEMS_MOUSE="$(find $HOME/.icons -mindepth 1 -maxdepth 1 -type d -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-mouse</action><action>refresh:PTHEME_MOUSE</action></menuitem>" | sort | grep -vE "ROX|default" &)"
MENUITEMS_GTKDIALOG="$(find /usr/share/ptheme/gtkdialog/ -mindepth 1 -maxdepth 1 -type f -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-gtkdialog</action><action>refresh:PTHEME_GTKDIALOG</action></menuitem>" | sort &)"
MENUITEMS_WALL="$(find /usr/share/backgrounds -mindepth 1 -maxdepth 1 -type f -printf "<menuitem label=\"%f\"><action>echo %f > $WORKDIR/ptheme-wall</action><action>refresh:PTHEME_WALL</action></menuitem>" | sort)"



               ##################################################
               ##                                              ##
               ##               F U N C T I O N S              ##
               ##                                              ##
               ##################################################


save (){
   find /usr/share/ptheme/globals -mindepth 1 -maxdepth 1 -type f -printf "<item>%f</item>\n" | sort > $WORKDIR/globals
   DEFAULT_NAME="$(<$WORKDIR/save_name)"
   #reset gtk-theme
   export GTK2_RC_FILES="`grep -m 1 gtkrc $HOME/.gtkrc-2.0 | cut -d'\"' -f2 2> /dev/null`"
   export savebox='
   <window title="pTheme - '$(gettext 'Save')'" icon-name="gtk-save" resizable="false">
   <vbox>
     <frame Save>
       <hbox>
         <text><label>'$(gettext 'Theme name')'</label></text>
         <comboboxentry>
           <variable>SAVEFILE</variable>
           '"$(find /usr/share/ptheme/globals -mindepth 1 -maxdepth 1 -type f -printf "<item>%f</item>" | sort)"'
           <default>'$DEFAULT_NAME'</default>
           <action>grep -F "ICON=" '$CONFDIR'/"$SAVEFILE" | cut -d\" -f2 > '$WORKDIR'/save_icon</action>
           <action>refresh:ICON</action>
         </comboboxentry>
       </hbox>
       <hbox>
         <text><label>'$(gettext 'Icon')'</label></text>
         <entry accept="file" width-request="300" fs-folder="'$HOME'" fs-title="pTheme - '$(gettext 'Theme icon')'">
           <variable>ICON</variable>
           <input file>'$WORKDIR'/save_icon</input>
         </entry>
         <button>
           <input file stock="gtk-open"></input>
           <action type="fileselect">ICON</action>
         </button>
       </hbox>
     </frame>
     <hbox space-expand="false" space-fill="false">
       <button>
         '"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
         <label>'$(gettext 'Cancel')'</label>
         <action type="exit">cancel</action>
       </button>
       <button can-default="true" has-default="true" use-stock="true">
         '"`/usr/lib/gtkdialog/xml_button-icon save`"'
         <label>'$(gettext 'Save')'</label>
         <action type="exit">save</action>
       </button>
     </hbox>
   </vbox>
   </window>'
   for STATEMENTS in "$(gtkdialog -p savebox --center)"; do
      eval $STATEMENTS 2> /dev/null
   done
   if [ "$EXIT" = "save" ]; then
      if [ -f "$CONFDIR/$SAVEFILE" ]; then
         . /usr/lib/gtkdialog/box_yesno "pTheme" "$(gettext 'Theme already exist.')" "<b>$(gettext 'Do you want to overwrite?')</b>"
         [ $EXIT = "no" ] && exit
      fi
      echo "ICON=\"$ICON\"
PTHEME_ICONS=\"$PTHEME_ICONS\"
PTHEME_GTK=\"$PTHEME_GTK\"
PTHEME_JWM_COLOR=\"$PTHEME_JWM_COLOR\"
PTHEME_JWM_BUTTONS=\"$PTHEME_JWM_BUTTONS\"
PTHEME_JWM_SIZE=\"$PTHEME_JWM_SIZE\"
PTHEME_WALL=\"$PTHEME_WALL\"
PTHEME_MOUSE=\"$PTHEME_MOUSE\"
PTHEME_GTKDIALOG=\"$PTHEME_GTKDIALOG\"
" > $CONFDIR/"$SAVEFILE"
      #reload gui to show changes
      ptheme & #start a new instance to see the changes in libstardust
      TMP="`ps -eo pid,command`"
      for I in `echo "$TMP" | grep -F $PID_PTHEME | awk '{print $1}'`; do kill -9 $I 2> /dev/null; done
   fi
}

set_theme (){
   /usr/lib/gtkdialog/box_splash -close never -fontsize large -icon_width 60 -icon /usr/share/pixmaps/puppy/puppy_config.svg -text "Changing theme" &
   XPID=$!
   #icons
if [ "$PTHEME_ICONS" ] && [ -d /usr/local/lib/X11/themes/"$PTHEME_ICONS" ]; then
      icon_switcher -a "$PTHEME_ICONS"
      rox -p=/root/Choices/ROX-Filer/PuppyPin
      UPDATE_JWM=true
      SWITCH_THEME=true
   fi
   #cursor
   if [ "$PTHEME_MOUSE" ] && [ -d $HOME/.icons/$PTHEME_MOUSE ]; then
      if [ "`echo "$PTHEME_MOUSE" | grep 'ORIGINAL THEME'`" ]; then
         ln -snf $HOME/.icons/default/default_nonsense $HOME/.icons/default #make broken link to get original pointer
      else
         ln -snf $HOME/.icons/$PTHEME_MOUSE $HOME/.icons/default
      fi
      UPDATE_JWM=true
      SWITCH_THEME=true
   fi
   #wallpaper
   if [ "$PTHEME_WALL" ] && [ -f "/usr/share/backgrounds/$PTHEME_WALL" ]; then
      echo "/usr/share/backgrounds/$PTHEME_WALL" > $HOME/.config/wallpaper/bg_img
      /usr/local/apps/Wallpaper/AppRun "/usr/share/backgrounds/$PTHEME_WALL"
      SWITCH_THEME=true
   fi
   #gtk
   if [ "$PTHEME_GTK" ] && [ -d "/usr/share/themes/$PTHEME_GTK" ]; then
      export GTK2_RC_FILES="$HOME/.gtkrc-2.0" #reset gtk-theme
      ptheme_gtk -t "$PTHEME_GTK" &
      SWITCH_THEME=true
   fi
   #jwm
   if [ "$PTHEME_JWM_COLOR" ] && [ -f $HOME/.jwm/themes/"$PTHEME_JWM_COLOR"-jwmrc ]; then
      /usr/local/jwmconfig2/theme_switcher -a "$PTHEME_JWM_COLOR"
      UPDATE_JWM=true
      SWITCH_THEME=true
   fi
   if [ "$PTHEME_JWM_BUTTONS" ] && [ -d /usr/share/pixmaps/jwm_button_themes/"$PTHEME_JWM_BUTTONS" ]; then
      /usr/local/jwmconfig2/window_buttons -a "$PTHEME_JWM_BUTTONS"
      UPDATE_JWM=true
      SWITCH_THEME=true
   fi
   if [ "$PTHEME_JWM_SIZE" ]; then
      case $PTHEME_JWM_SIZE in
      small)
         /usr/local/jwmconfig2/taskbarHeight 20
         rm $HOME/.jwm/menuheights
         fixmenus
         UPDATE_JWM=true
         SWITCH_THEME=true
         ;;
      normal)
         /usr/local/jwmconfig2/taskbarHeight 28
         echo "MENHEIGHT=24" > $HOME/.jwm/menuheights
         fixmenus
         UPDATE_JWM=true
         SWITCH_THEME=true
         ;;
      large)
         /usr/local/jwmconfig2/taskbarHeight 32
         echo "MENHEIGHT=32" > $HOME/.jwm/menuheights
         fixmenus
         UPDATE_JWM=true
         SWITCH_THEME=true
         ;;
      huge)
         /usr/local/jwmconfig2/taskbarHeight 40
         echo "MENHEIGHT=32" > $HOME/.jwm/menuheights
         fixmenus
         UPDATE_JWM=true
         SWITCH_THEME=true
         ;;
      esac
   fi
   [ "$UPDATE_JWM" = "true" ] && jwm -restart
   #kill splash
   kill $XPID
   #gtkdialog
   if [ "$PTHEME_GTKDIALOG" ] && [ -f "/usr/share/ptheme/gtkdialog/$PTHEME_GTKDIALOG" ]; then
      cp -f "/usr/share/ptheme/gtkdialog/$PTHEME_GTKDIALOG" $HOME/.config/ptheme/gtkdialog_active
      ptheme & #start a new instance to see the changes in libstardust
      TMP="`ps -eo pid,command`"
      for I in `echo "$TMP" | grep -F $PID_PTHEME | awk '{print $1}'`; do kill -9 $I 2> /dev/null; done
      SWITCH_THEME=true
   fi
   if [ "$SWITCH_THEME" != "true" ]; then
      /usr/lib/gtkdialog/box_ok "pTheme" error "$(gettext "Theme modules aren't set, or not valid")"
   fi
}

update_preset (){
   . $CONFDIR/"$1"
   echo "$PTHEME_ICONS"      > $WORKDIR/ptheme-icons
   echo "$PTHEME_GTK"         > $WORKDIR/ptheme-gtk
   echo "$PTHEME_JWM_COLOR"   > $WORKDIR/ptheme-jwm
   echo "$PTHEME_JWM_BUTTONS"   > $WORKDIR/ptheme-jwm_buttons
   echo "$PTHEME_JWM_SIZE"      > $WORKDIR/ptheme-jwm_size
   echo "$PTHEME_WALL"       > $WORKDIR/ptheme-wall
   echo "$PTHEME_MOUSE"      > $WORKDIR/ptheme-mouse
   echo "$PTHEME_GTKDIALOG"   > $WORKDIR/ptheme-gtkdialog
}
export -f save set_theme update_preset

               ##################################################
               ##                                              ##
               ##                 P R O G R A M                ##
               ##                                              ##
               ##################################################

#parameters
while [ $# != 0 ]; do
   I=1
   while [ $I -le `echo $# | wc -c` ]; do
      case $1 in
         -p) PRESET="$2"; . $CONFDIR/$PRESET; set_theme; exit;;
         -h|--help)
echo 'Usage: ptheme [OPTION]

Options
  -p PRESET   Activate global theme
  -h          Show this help message'; exit;;
      esac
      shift
      I=$[$I+1]
   done
done

#clean up
echo -n > $WORKDIR/ptheme-icons
echo -n > $WORKDIR/ptheme-gtk
echo -n > $WORKDIR/ptheme-jwm
echo -n > $WORKDIR/ptheme-jwm_buttons
echo -n > $WORKDIR/ptheme-jwm_size
echo -n > $WORKDIR/ptheme-wall
echo -n > $WORKDIR/ptheme-mouse
echo -n > $WORKDIR/ptheme-gtkdialog

XML_GLOBALS=''
while read I in; do
   ICON="$(grep -F 'ICON=' /usr/share/ptheme/globals/$I | cut -d= -f2 | tr -d '"')"
   [ ! "$ICON" ] && ICON=/usr/share/pixmaps/puppy/puppy_theme_generic.svg
   XML_GLOBALS=${XML_GLOBALS}'
   <button image-position="2" relief="2">
     <label>"'$I'"</label>
     '"`/usr/lib/gtkdialog/xml_button-icon "$ICON" huge`"'
     <action>update_preset "'$I'"</action>
     <action>echo "'$I'" > '$WORKDIR'/save_name</action>
     <action>echo "'$ICON'" > '$WORKDIR'/save_icon</action>
     <action>activate:UPDATER</action>
   </button>'
done <<< "$(find /usr/share/ptheme/globals -mindepth 1 -maxdepth 1 -type f -printf "%f\n" | sort)"


S='
<window title="pTheme" icon-name="gtk-preferences">
<vbox space-expand="true" space-fill="true">
  '"`/usr/lib/gtkdialog/xml_info fixed "puppy_theme.svg" 60 "$(gettext 'A <b>global theme</b> affects all themable modules in Puppy. Choose either a global theme or dig deeper into one of the modules.')"`"'
  <button visible="false">
    <variable>UPDATER</variable>
    <action>refresh:PTHEME_ICONS</action>
    <action>refresh:PTHEME_GTK</action>
    <action>refresh:PTHEME_JWM_COLOR</action>
    <action>refresh:PTHEME_JWM_BUTTONS</action>
    <action>refresh:PTHEME_JWM_SIZE</action>
    <action>refresh:PTHEME_WALL</action>
    <action>refresh:PTHEME_MOUSE</action>
    <action>refresh:PTHEME_GTKDIALOG</action>
  </button>
  <vbox space-expand="true" space-fill="true">
      <hbox margin="5" height="130" height-request="10" scrollable="true" space-expand="true" space-fill="true">
      '$XML_GLOBALS'
      </hbox>
    <frame '$(gettext 'Theme modules')'>
      <vbox space-expand="false" space-fill="false">

##  I C O N S

   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Desktop icons')'" stock="gtk-arrow_down">
        '$MENUITEMS_ICONS'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-icons</action>
          <action>refresh:PTHEME_ICONS</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_ICONS</variable>
     <input>cat '$WORKDIR'/ptheme-icons</input>
    </entry>
    <button space-expand="false" space-fill="false">
     <label>'$(gettext 'More')'</label>
     '"`/usr/lib/gtkdialog/xml_button-icon desktop_icons`"'
     <action>icon_switcher &</action>
    </button>
    <button relief="2" width-request="50" space-expand="false" space-fill="false">
     <label>www</label>
     <action>defaulthtmlviewer http://www.murga-linux.com/puppy/viewtopic.php?t=31059 &</action>
    </button>
   </hbox>

##  G T K

   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Program decoration (gtk)')'" stock="gtk-arrow_down">
        '$MENUITEMS_GTK'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-gtk</action>
          <action>refresh:PTHEME_GTK</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_GTK</variable>
     <input>cat '$WORKDIR'/ptheme-gtk</input>
    </entry>
    <button space-expand="false" space-fill="false">
     <label>'$(gettext 'More')'</label>
     '"`/usr/lib/gtkdialog/xml_button-icon button`"'
     <action>ptheme_gtk &</action>
    </button>
    <button relief="2" width-request="50" space-expand="false" space-fill="false">
     <label>www</label>
     <action>defaulthtmlviewer http://www.murga-linux.com/puppy/viewtopic.php?t=30075 &</action>
    </button>
   </hbox>'

##  J W M

   [ "`grep -F 'jwm' <<< $(ps -eo pid,command)`" ] && S=$S'
   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Colors of Window / Tray / Menu')'" stock="gtk-arrow_down">
        '$MENUITEMS_JWM_COLOR'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-jwm</action>
          <action>refresh:PTHEME_JWM_COLOR</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_JWM_COLOR</variable>
     <input>cat '$WORKDIR'/ptheme-jwm</input>
    </entry>
    <button space-expand="false" space-fill="false">
     <label>'$(gettext 'More')'</label>
     '"`/usr/lib/gtkdialog/xml_button-icon windows`"'
     <action>/usr/local/jwmconfig2/theme_switcher &</action>
    </button>
    <button relief="2" width-request="50" space-expand="false" space-fill="false">
     <label>www</label>
     <action>defaulthtmlviewer http://www.murga-linux.com/puppy/viewtopic.php?t=23260 &</action>
    </button>
   </hbox>
   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Window buttons')'" stock="gtk-arrow_down">
        '$MENUITEMS_JWM_BUTTONS'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-jwm_buttons</action>
          <action>refresh:PTHEME_JWM_BUTTONS</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_JWM_BUTTONS</variable>
     <input>cat '$WORKDIR'/ptheme-jwm_buttons</input>
    </entry>
    <button space-expand="false" space-fill="false">
     <label>'$(gettext 'More')'</label>
     '"`/usr/lib/gtkdialog/xml_button-icon windows_buttons`"'
     <action>/usr/local/jwmconfig2/window_buttons &</action>
    </button>
    <text width-request="50" space-expand="false" space-fill="false"><label>""</label></text>
   </hbox>

   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Tray/Menu size')'" stock="gtk-arrow_down">
        <menuitem label="'$(gettext 'small')'">
          <action>echo small > $WORKDIR/ptheme-jwm_size</action>
          <action>refresh:PTHEME_JWM_SIZE</action>
        </menuitem>
        <menuitem label="'$(gettext 'normal')'">
          <action>echo normal > $WORKDIR/ptheme-jwm_size</action>
          <action>refresh:PTHEME_JWM_SIZE</action>
        </menuitem>
        <menuitem label="'$(gettext 'large')'">
          <action>echo large > $WORKDIR/ptheme-jwm_size</action>
          <action>refresh:PTHEME_JWM_SIZE</action>
        </menuitem>
        <menuitem label="'$(gettext 'huge')'">
          <action>echo huge > $WORKDIR/ptheme-jwm_size</action>
          <action>refresh:PTHEME_JWM_SIZE</action>
        </menuitem>
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-jwm_size</action>
          <action>refresh:PTHEME_JWM_SIZE</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_JWM_SIZE</variable>
     <input>cat '$WORKDIR'/ptheme-jwm_size</input>
    </entry>
    <button space-expand="false" space-fill="false">
     <label>'$(gettext 'More')'</label>
     '"`/usr/lib/gtkdialog/xml_button-icon size`"'
     <action>/usr/local/jwmconfig2/taskbar &</action>
    </button>
    <text width-request="50" space-expand="false" space-fill="false"><label>""</label></text>
   </hbox>'

##  W A L L P A P E R

   S=$S'
   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Wallpaper')'" stock="gtk-arrow_down">
        '$MENUITEMS_WALL'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-wall</action>
          <action>refresh:PTHEME_WALL</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_WALL</variable>
     <input>cat '$WORKDIR'/ptheme-wall</input>
    </entry>
    <button space-expand="false" space-fill="false">
     <label>'$(gettext 'More')'</label>
     '"`/usr/lib/gtkdialog/xml_button-icon wallpaper`"'
     <action>wallpaper &</action>
    </button>
    <text width-request="50" space-expand="false" space-fill="false"><label>""</label></text>
   </hbox>

##  M O U S E

   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Mouse pointer')'" stock="gtk-arrow_down">
        '$MENUITEMS_MOUSE'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-mouse</action>
          <action>refresh:PTHEME_MOUSE</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_MOUSE</variable>
     <input>cat '$WORKDIR'/ptheme-mouse</input>
    </entry>
    <button space-expand="false" space-fill="false">
     '"`/usr/lib/gtkdialog/xml_button-icon mouse_cursor`"'
     <label>'$(gettext 'More')'</label>
     <action>pcur &</action>
    </button>
    <button relief="2" width-request="50" space-expand="false" space-fill="false">
     <label>www</label>
     <action>defaulthtmlviewer http://www.murga-linux.com/puppy/viewtopic.php?t=37852 &</action>
    </button>
   </hbox>

##  G T K D I A L O G

   <hbox space-expand="true" space-fill="true">
    <menubar space-expand="true" space-fill="true">
      <menu label="'$(gettext 'Puppy top-layer')'" stock="gtk-arrow_down">
        '$MENUITEMS_GTKDIALOG'
        <menuitem label="">
          <action>echo "" > $WORKDIR/ptheme-gtkdialog</action>
          <action>refresh:PTHEME_GTKDIALOG</action>
        </menuitem>
      </menu>
    </menubar>
    <entry editable="false" width-request="150" space-expand="false" space-fill="false">
     <variable>PTHEME_GTKDIALOG</variable>
     <input>cat '$WORKDIR'/ptheme-gtkdialog</input>
    </entry>
    <button space-expand="false" space-fill="false">
     '"`/usr/lib/gtkdialog/xml_button-icon info`"'
     <label>'$(gettext 'More')'</label>
     <action>echo "'$(gettext 'The Puppy top-layer controls color and size of gui-templates in /usr/lib/gtkdialog/. The config files is found in /usr/share/ptheme/gtkdialog.')'" > /tmp/box_help; /usr/lib/gtkdialog/box_help "pTheme" info.svg &</action>
    </button>
    <text width-request="50" space-expand="false" space-fill="false"><label>""</label></text>
   </hbox>


   </vbox>
  </frame>
  </vbox>
  <hbox space-expand="false" space-fill="false">
   <button>
     '"`/usr/lib/gtkdialog/xml_button-icon save`"'
     <label>'$(gettext 'Save global theme')'</label>
     <action>save</action>
     <action>refresh:PRESET</action>
   </button>
   <button>
     '"`/usr/lib/gtkdialog/xml_button-icon apply`"'
    <label>'$(gettext 'Apply theme')'</label>
    <action>set_theme</action>
   </button>
   <button>
     '"`/usr/lib/gtkdialog/xml_button-icon quit`"'
     <label>'$(gettext 'Quit')'</label>
   </button>
   '"`/usr/lib/gtkdialog/xml_scalegrip`"'
  </hbox>
 </vbox>
</window>'
echo "$S" | sed -e 's/##.*//' > $WORKDIR/xml_$PID_PTHEME  #I use double hash (##) for comments. Colors are defined as #FF0000

#gtk theme
echo 'pixmap_path "/usr/share/pixmaps/puppy/"
style "icon-style"
{
  stock["gtk-arrow_down"] = {{ "arrow_mini_down.svg", *, *, *}}
}
class "GtkWidget" style "icon-style"' > /tmp/gtkrc_ptheme
export GTK2_RC_FILES=/tmp/gtkrc_ptheme:$HOME/.gtkrc-2.0
#---

. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
gtkdialog -f $WORKDIR/xml_$PID_PTHEME
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Sun 27 Jul 2014, 13:59    Post subject:  

gettext in 'f2fs-usb-installer'

Add 2 lines at 17 and 18

Code:
export TEXTDOMAIN=f2fs-usb-installer
export OUTPUT_CHARSET=UTF-8


Code:
#!/bin/bash

# spring /autumn equinox 2013
# (c) Michael Amadio, 01micko@gmail.com, GPL v2 2013
# wizard style script to install to an f2fs flash drive in puppylinux
#-----------------------------------------------------------------------------#
# depends:
# k >=3.8, with f2fs as builtin or module,
# +gtkdialog >=0.8,
# +gparted>=1.4.1 patched for f2fs
# +gettext
# +syslinux >= 4.0 for vesamenu (optional)
#-----------------------------------------------------------------------------#

# check f2fs support

export TEXTDOMAIN=f2fs-usb-installer
export OUTPUT_CHARSET=UTF-8

CFIG=/etc/modules/DOTconfig*
. $CFIG
if [ ! "$CONFIG_F2FS_FS" ];then
  MSG1=$(gettext "f2fs is not supported in your kernel.\nExiting now")
  Xdialog -title f2fs -msgbox "$MSG1" 0 0
  exit
fi

# setup TMP
mkdir -p /mnt/f2fs 2>/dev/null
TMP=/mnt/f2fs

# find usb drive
probedisk|grep 'usb' > $TMP/f2fs-wiz-list
if [ ! -s "$TMP/f2fs-wiz-list" ];then
  MSG2=$(gettext "A USB drive can not be found\
  \nIs it plugged in?.\nExiting now")
  Xdialog -title f2fs -msgbox "$MSG2" 0 0
  exit
fi

# check if syslinux supports vesamenu
grep -q 'vesamenu' ~/.packages/builtin_files/syslinux
BIVAL=$?
grep -q 'vesamenu' ~/.packages/* 2>/dev/null
INVAL=$?
[[ "$BIVAL" = "0" || "$INVAL" = "0" ]] && VMENU="yes" || VMENU=""

if [ "$VMENU" ];then
  # define syslinux dir
  SYSDIR=`find /usr -type f -name vesamenu.c32|sed 's%/vesamenu.c32%%'`
  # check to see if we are doing an add on or new install
  FEXISTS=`probepart|grep -E 'f2fs'`
  if [ "$FEXISTS" ];then
    FPART1=`probepart|grep -E 'vfat'|cut -d '|' -f1`
    FPART2=`echo $FEXISTS|cut -d '|' -f1`
    EMSG1=$(gettext "seems to already be an f2fs partition")
    EMSG2=$(gettext "Do you want to add another f2fs aware Puppy and make your drive multiboot?")
    FMSG=$(gettext "This only works on FRUGAL type installs.")
    export egui='<window title="f2fs installer - multiboot" window-position="1">
      <vbox>
        <frame>
          <text><label>"'"$FPART2 $EMSG1"'"</label></text>
          <text><label>"'"$EMSG2"'"</label></text>
          <text><label>"'"$FMSG"'"</label></text>
        </frame>
        <hbox homogeneous="true">
          <button yes></button><button no></button>
        </hbox>
      </vbox>
    </window>'
    eval `gtkdialog -p egui -c`
    case $EXIT in
    Yes)EXINST="yes";FULLINST="no" ;;
    *)EXINST="" ;;
    esac
  fi
  else
    SYSDIR=/usr/lib/syslinux
    SMSG1=$(gettext "You have a version of syslinux that does not support a boot menu. That is fine but you will not be able to dual boot your media.")
    SMSG2=$(gettext "Do you want to quit this program now and install a more complete version of syslinux? Selecting <b>Yes</b> will exit the program")
    export sgui='<window title="f2fs installer - multiboot" window-position="1">
      <vbox>
        <frame>
          <text><label>"'"$SMSG1"'"</label></text>
          <text use-markup="true"><label>"'"$SMSG2"'"</label></text>
        </frame>
        <hbox homogeneous="true">
          <button yes></button><button no></button>
        </hbox>
      </vbox>
    </window>'
    eval `gtkdialog -p sgui -c`
    case $EXIT in
    Yes)exit ;;
    *)echo "ok" ;;
    esac
fi

if [ ! "$EXINST" ];then #big if
# construct gui 1
  DESC=$(gettext "USB device - ")
  while read line
    do dev=${line%%|*}
    desc=${line##*|}
    echo "<radiobutton>
     <label>$DESC $dev $desc</label>
     <variable>$dev</variable>
    </radiobutton>" >> $TMP/f2fs-wiz-radbtn
    done <$TMP/f2fs-wiz-list
  RADBTN=`cat $TMP/f2fs-wiz-radbtn`
  export gui1='<window title="f2fs usb installer - 1" window-position="1">
    <vbox>
      <text use-markup="true"><label>"<b>'$(gettext "Welcome to the f2fs to usb drive installer wizard.")'</b>"</label></text>
      <hseparator></hseparator>
      <text><label>'$(gettext "Please choose the drive you wish to install to below.")'</label></text>
      <frame>
       '$RADBTN'
      </frame>
      <hbox homogeneous="true"><button ok></button></hbox>
    </vbox>
  </window>'
  gtkdialog -p gui1 > $TMP/f2fs-chosen
  CHOSEN=`grep "true" $TMP/f2fs-chosen|cut -d '=' -f1`
  echo $CHOSEN
  if [ ! "$CHOSEN" ];then
   rm $TMP/f2fs*
   exit
  fi


  DESC2=`grep $CHOSEN $TMP/f2fs-wiz-list|rev|cut -d '|' -f1|rev`
  # splash some info
  echo '<window title="f2fs usb installer" window-position="1">
    <vbox>
      <frame>
      <text><label>'$(gettext "You have chosen ")$CHOSEN - $DESC2'</label></text>
      <text><label>'$(gettext "When you click OK gparted will open to allow you to partition your drive. It is recommended to make the first partition FAT32 of size 32 MB then partition the rest of the drive with f2fs. Be sure the drive is not mounted and be aware that all data on the drive will be destroyed. You may want to write this down.")'</label></text>
     <text use-markup="true"><label>"<b>'$(gettext "Be sure to mark the first partition with the boot flag in gparted")'</b>"</label></text>
     </frame>
     <hbox homogeneous="true"><button ok></button></hbox>
    </vbox>
  </window>'|gtkdialog -s

  # run gparted on chosen partition
  gparted $CHOSEN
 
  rm $TMP/f2fs*
  # sanity check
  dev1=${CHOSEN}1
  dev2=${CHOSEN}2
  FST1=`guess_fstype $dev1`
  FST2=`guess_fstype $dev2`
  echo $FST1 $FST2
  MSG_FS1_1=$(gettext "is of type")
  MSG_FS1_2=$(gettext "it needs to be vfat.\nExiting now.")
  MSG_FS2_2=$(gettext "it needs to be of type f2fs.\nExiting now.")
  if ! [ "`echo $FST1|grep vfat`" ];then
    Xdialog -title "f2fs - partition 1" -msgbox "$dev1 $MSG_FS1_1 $FST1 \n${MSG_FS1_2}" 0 0 0
    exit
  fi
 
    if ! [ "`echo $FST2|grep f2fs`" ];then
    Xdialog -title "f2fs - partition 2" -msgbox "$dev2 $MSG_FS1_1 $FST2 \n${MSG_FS2_2}" 0 0 0
    exit
  fi
  else
  dev1=$FPART1
  dev2=$FPART2
  CHOSEN=`echo $FPART1|tr -d '1'`
  echo $CHOSEN
  #echo "enter dummy!" #debug
  #read bla
fi #end big if (start line ~50)
# full install
if [ "$FULLINST" != "no" ];then
  FULLB=$(gettext "FULL")
  FRUGALB=$(gettext "FRUGAL")
  FORKMSG=$(gettext "You can now decide if you want a \n\nFULL or FRUGAL\n\ninstall of the f2fs filesystem USB device")
  Xdialog --title "f2fs - Full or Frugal?" --ok-label "$FRUGALB" --cancel-label "$FULLB" --yesno "$FORKMSG $CHOSEN" 0 0 0
  case $? in
   0)echo frugal chosen ;;
   1)xterm -bg yellow -e f2fs_full_installer && exit ;;
   255)exit;;
  esac
fi
   
# gui 2
export gui2='<window title="f2fs usb installer - 2" window-position="1">
  <vbox>
    <text use-markup="true"><label>"<b>'$(gettext "Now it's time to specify your files.")'</b>"</label></text>
    <hseparator></hseparator>
    <text use-markup="true"><label>"<i>'$(gettext "Please choose where the Puppy files are located. The Puppy <u>must</u> be f2fs compatible!!!")'</i>"</label></text>
    <frame>
     <hbox homogeneous="true">
       <radiobutton><label>cd</label><variable>rb0</variable></radiobutton>
       <radiobutton><label>iso image</label><variable>rb1</variable></radiobutton>
       <radiobutton><label>files</label><variable>rb2</variable></radiobutton>
     </hbox>
    </frame>
    <hbox homogeneous="true"><button ok></button></hbox>
  </vbox>
</window>'
gtkdialog -p gui2 > $TMP/f2fs-gui2
. $TMP/f2fs-gui2

# find and copy pup files
copy_func(){
   export SRCF=$1
   MNTUSB=`echo ${dev2}|cut -d '/' -f3`
   echo $MNTUSB
   mkdir -p $TMP/${MNTUSB}
   mount -t f2fs ${dev2} $TMP/${MNTUSB}
   if [ ! -d $TMP/${MNTUSB}/$DIRN ];then
     mkdir -p $TMP/${MNTUSB}/$DIRN
     else
     BADMSG=$(gettext "already exists in the target drive. \nAborting.")
     Xdialog -title "f2fs - Abort" -msgbox "$DIRN $BADMSG" 0 0 0
     exit
   fi
    for s in `ls $1|grep 'sfs$'`
      do cp -a ${1}/$s $TMP/${MNTUSB}/${DIRN}/
      done
   touch $TMP/${MNTUSB}/${DIRN}/USBFLASH
   sync
   umount $TMP/${MNTUSB}
}

CPMSG1="$(gettext "copying all the files to")"
CPMSG2="$(gettext "Please wait")"
case $EXIT in
OK)if [ "$rb0" = "true" ];then
    Xdialog -title "f2fs -  Copying" \
    -msgbox "$CPMSG1 $dev2 \n$CPMSG2" 0 0 0 &
    XPID=$!
    mkdir -p $TMP/cdmnt #mountpoint
    mount -t iso9660 /dev/sr0 $TMP/cdmnt -o loop,ro
    if [ "$?" -ne 0 ];then
      sleep 1
      kill -9 $XPID
      Xdialog -title "failed copy" \
      -msgbox "$(gettext "Failed to mount the CD! \nIs it there? \nExiting")" 0 0 0
      exit
    fi
    DIRN=`ls $TMP/cdmnt|grep '^puppy'|grep 'sfs$'|cut -d '_' -f2,3|rev|cut -d '.' -f2,3,4,5,6|rev`
    copy_func $TMP/cdmnt
    #umount $TMP/cdmnt
    kill -9 $XPID
   elif [ "$rb1" = "true" ];then
     ISO="`Xdialog -title "f2fs - find ISO image" \
     -backtitle "$(gettext "Please find the Puppy ISO image\nthat you want to use for your install.")" \
     -stdout --no-buttons --no-cancel --fselect "*" 0 0`"
     [ ! $? -eq 0 ] && exit
     if [ ! `echo $ISO|grep 'iso$'` ];then
       Xdialog -title "f2fs - failed" \
       -msgbox "$ISO $(gettext "is not an ISO image! \nExiting")" 0 0 0
       exit
     fi
    Xdialog -title "f2fs -  Copying" \
    -msgbox "$CPMSG1 $dev2 \n$CPMSG2" 0 0 0 &
    XPID=$!
    mkdir -p $TMP/cdmnt #mountpoint
    mount -t iso9660 $ISO $TMP/cdmnt -o loop,ro
    if [ "$?" -ne 0 ];then
      sleep 1
      kill -9 $XPID
      Xdialog -title "failed copy" \
      -msgbox "$(gettext "Failed to mount the ISO! \nIs it valid? \nExiting")" 0 0 0
      exit
    fi
    DIRN=`ls $TMP/cdmnt|grep '^puppy'|grep 'sfs$'|cut -d '_' -f2,3|rev|cut -d '.' -f2,3,4,5,6|rev`
    copy_func $TMP/cdmnt
    #umount $TMP/cdmnt
    kill -9 $XPID
   else # extracted from PUI, BK
     SRCFPATH="`Xdialog -title "f2fs - find files" \
     -backtitle "$(gettext "Please find the latest Puppy files\nvmlinuz, initrd.gz and related sfs files,\nTHEN HIGHLIGHT ANY ONE OF THEM in the right pane \nand click the OK button")" \
     -stdout --no-buttons --no-cancel --fselect "*" 0 0`"
     [ ! $? -eq 0 ] && exit
     SRCPATH="`dirname $SRCFPATH`"
     if [ ! -f ${SRCPATH}/initrd.gz ];then
       Xdialog -title "f2fs - failed" \
       -msgbox "$(gettext "No Puppy files found in that directory! \nExiting")" 0 0 0
       exit
     fi
     echo $SRCPATH
     Xdialog -title "f2fs -  Copying" \
    -msgbox "$CPMSG1 $dev2 \n$CPMSG2" 0 0 0 &
    XPID=$!
    DIRN=`ls $SRCPATH|grep '^puppy'|grep 'sfs$'|cut -d '_' -f2,3|rev|cut -d '.' -f2,3,4,5,6|rev`
    echo $DIRN #; read
    copy_func $SRCPATH
     if [ "$?" -ne 0 ];then
      sleep 1
      kill -9 $XPID
      Xdialog -title "failed copy" \
      -msgbox "$(gettext "Failed to copy the files! \nIs the path valid? \nExiting")" 0 0 0
      exit
    fi
    kill -9 $XPID
   fi
;;
*)exit
;;
esac

# boot files
# for the vfat boot partition
boot_copy_func(){
   MNTUSBBOOT=`echo ${dev1}|cut -d '/' -f3`
   echo $MNTUSBBOOT
   mkdir -p $TMP/${MNTUSBBOOT}
   mount -t vfat ${dev1} $TMP/${MNTUSBBOOT}
   mkdir -p $TMP/${MNTUSBBOOT}/$BOOTD
   for p in initrd.gz vmlinuz
      do cp -a $1/$p $TMP/${MNTUSBBOOT}/${BOOTD}/
      done
   
   if [ "$VMENU" ];then
    mkdir -p $TMP/${MNTUSBBOOT}/img
    for i in `ls /usr/share/img`
      do cp /usr/share/img/$i $TMP/${MNTUSBBOOT}/img
      done
    ( cd $TMP/${MNTUSBBOOT}/img ; [ ! -f default.jpg ] && cp $CJPEG default.jpg )
    for b in vesamenu.c32 chain.c32
      do cp ${SYSDIR}/$b $TMP/${MNTUSBBOOT} 2>/dev/null #top level
      done
    fi
   sync
   #umount $TMP/${MNTUSBBOOT}
}
   
BOOTD=${DIRN}

new_func(){
   # choice of image
   IMGDIR=/usr/share/img/
   ls $IMGDIR > $TMP/f2fs-images
   
   export gui3='<window title="f2fs usb installer - 3" window-position="1">
     <vbox>
       <text use-markup="true"><label>"<b>'$(gettext "Please choose an image for your menu.")'</b>"</label></text>
       <hseparator></hseparator>
       <text use-markup="true"><label>"<i>'$(gettext "You can add a custom image to <b>/usr/share/img</b> but it must be 1024x768 JPEG format")'</i>"</label></text>
       <frame>
        <tree>
           <label>Image</label>
         <variable>SELECTION</variable>
         <width>250</width>
         <height>150</height>
         <input>cat /mnt/f2fs/f2fs-images</input>
         <action signal="button-release-event">exit:chosen</action>
        </tree>
       </frame>
      
     </vbox>
   </window>'
   eval `gtkdialog -p gui3 -c`
   case $EXIT in
   chosen)CJPEG="$SELECTION" ; boot_copy_func $SRCF;;
   *)exit ;;
   esac
   
   # copy the files
   #boot_copy_func
   
   LABEL="`echo $DIRN|tr '_' ' '`"
   #UUID=`blkid $dev2|tr '"' '\n'|grep ^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]` 
   
   # construct menu
cat > $TMP/${MNTUSBBOOT}/syslinux.cfg <<_EOL
PROMPT 0
TIMEOUT 80
DEFAULT /vesamenu.c32
MENU RESOLUTION 1024 768
MENU BACKGROUND /img/default.jpg
MENU TITLE Puppy Linux

MENU WIDTH 30
MENU MARGIN 2
MENU ROWS 15
MENU HELPMSGROW 19
MENU TIMEOUTROW 20
MENU TABMSGROW 21
MENU CMDLINEROW 23
MENU HSHIFT 50
MENU VSHIFT 5

   menu color screen   37;40      #00000000 #00000000 none
   menu color border   30;44      #00000000 #00000000 none
   menu color title   1;36;44    #00000000 #00000000 none
   menu color unsel   37;44      #ff6a6a6a #00000000 none
   menu color hotkey   1;37;44    #ff6a6a6a #00000000 none
   menu color sel      7;37;40    #ffffffff #ff6a6a6a none
   menu color hotsel   1;7;37;40  #ff808080 #ff6a6a6a none
   menu color scrollbar   30;44      #00000000 #00000000 none

   menu color tabmsg   31;40      #aaaaaaaa #00000000 none
   menu color cmdmark   1;36;40    #ffff0000 #00000000 none
   menu color cmdline   37;40      #aaaaaaaa #00000000 none
   menu color pwdborder   30;47      #ffff0000 #00000000 std
   menu color pwdheader   31;47      #ffff0000 #00000000 std
   menu color pwdentry   30;47      #ffff0000 #00000000 std
   menu color timeout_msg   37;40      #aaaaaaaa #00000000 none
   menu color timeout   1;37;40    #ffaaaaff #00000000 none
   menu color help      37;40      #aaaaaa00 #00000000 none
   menu color msg07   37;40      #90ffffff #00000000 std


LABEL ${LABEL%% *}
MENU LABEL  $LABEL
KERNEL /${BOOTD}/vmlinuz
APPEND initrd=/${BOOTD}/initrd.gz pmedia=usbflash psavemark=2

MENU SEPARATOR


LABEL windows
MENU LABEL Windows
COM32 chain.c32
APPEND hd1 1 swap

MENU SEPARATOR

LABEL hd
MENU LABEL Boot from 1st HD
localboot -1
_EOL
}

addfunc(){
   # copy boot files
   boot_copy_func $SRCF
   
   # add entry to syslinux.cfg
   LABEL="`echo $DIRN|tr '_' ' '`"   
   NENTRY="LABEL ${LABEL%% *}
MENU LABEL  ${LABEL}
KERNEL /${BOOTD}/vmlinuz
APPEND initrd=/${BOOTD}/initrd.gz pmedia=usbflash psavemark=2

MENU SEPARATOR
"

   while read a
     do [ "`echo "$a"|grep 'windows'`" ] && break || echo $a >> $TMP/f2fs-part-a
     done <$TMP/${MNTUSBBOOT}/syslinux.cfg
   echo "$NENTRY" >> $TMP/f2fs-part-a
   echo 'LABEL windows
MENU LABEL Windows
COM32 chain.c32
APPEND hd1 1 swap
   
MENU SEPARATOR
   
LABEL hd
MENU LABEL Boot from 1st HD
localboot -1
' >>$TMP/f2fs-part-a
   cat $TMP/f2fs-part-a >$TMP/${MNTUSBBOOT}/syslinux.cfg
   
}

# function for old syslinux
old_func(){
   # copy boot files
   boot_copy_func $SRCF
   
   # old stuff
   echo "default /${BOOTD}/vmlinuz initrd=/${BOOTD}/initrd.gz pmedia=ataflash psavemark=2" >$TMP/${MNTUSBBOOT}/syslinux.cfg
}

if [ "$EXINST" = "yes" ];then
  addfunc
  else
  if [ "$VMENU" ];then
  new_func
  extlinux -i $TMP/${MNTUSBBOOT}
    else
  old_func
  syslinux $dev1
  fi
fi
   
sync

# mbr
dd bs=440 count=1 conv=notrunc if=${SYSDIR}/mbr.bin of=${CHOSEN}
   
# cleanup
sync
sleep 1
umount $TMP/${MNTUSBBOOT}
umount $TMP/cdmnt 2>/dev/null
rm -r $TMP

Xdialog -title "f2fs - complete" -msgbox \
"$(gettext "Your installation is now complete. \nYou may now remove USB drive.") $CHOSEN" 0 0 0
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Tue 29 Jul 2014, 05:43    Post subject:  

Aggiornamento langpacks
Langpacks updated
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Thu 07 Aug 2014, 12:59    Post subject:  

Dopo una attenta ed accurata rivisitazione di Puppy, rimangono ancora da tradurre diversi files.
After a careful and thorough review of Puppy, remain to translate several files.

Ecco l'elenco degli ultimi files da tradurre:
Here is the list of last files to be translated:

no gettext:
psi-about
psi-preferences
Floppy_Formatter
pns-tool-wrapper
prename
snap2
snap2engine
snap2shell
video-info
video-info-glx
video_upgrade
wcpufreq
xorgwizard-automatic
xorgwizard-cli

external files.mo -- perhaps:
gfnrename
gmeasures
gpptp

impossible:
flsynclient
psip32
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Mon 11 Aug 2014, 07:08    Post subject:  

New files edited with gettext:

All files are tested.

-part7
snap2
snap2engine
snap2shell

-part6
dir2pet
dirs2pets
dir2tgz
dir2sfs

-part5
sys-info
pdvdrsab
pmetatagger
sfsconvert + func

-part1 (update 2014-08-16)
Floppy_Formatter
video-info
video-info-glx
xorgwizard-automatic
gettext_part7.tar.gz
Description 
gz

 Download 
Filename  gettext_part7.tar.gz 
Filesize  21.09 KB 
Downloaded  22 Time(s) 
gettext_part6.tar.gz
Description 
gz

 Download 
Filename  gettext_part6.tar.gz 
Filesize  6.39 KB 
Downloaded  23 Time(s) 
gettext_part5.tar.gz
Description 
gz

 Download 
Filename  gettext_part5.tar.gz 
Filesize  24.11 KB 
Downloaded  28 Time(s) 
gettext_part1.tar.gz
Description 
gz

 Download 
Filename  gettext_part1.tar.gz 
Filesize  10.36 KB 
Downloaded  33 Time(s) 

Last edited by xanad on Sat 30 Aug 2014, 06:12; edited 11 times in total
Back to top
View user's profile Send private message Visit poster's website 
xanad


Joined: 28 Feb 2014
Posts: 170
Location: 2 locations: MonteRosa Alp and Milano

PostPosted: Thu 14 Aug 2014, 04:42    Post subject:  

New files edited with gettext:

-part2-
pns-tool
prename
connectwizard_2nd --> Found some 'gettext' errors in the original file from line 252 to 260. Fixed

-part3-
desksetup.sh
deskshortcut.sh
didiwiki-gui
f2fs-usb-installer
wirelesswizard

-part4-
gparted_shell
menumanager
Pdisk
psync
psyncfunc
gettext_part2.tar.gz
Description 
gz

 Download 
Filename  gettext_part2.tar.gz 
Filesize  10.25 KB 
Downloaded  38 Time(s) 
gettext_part4.tar.gz
Description 
gz

 Download 
Filename  gettext_part4.tar.gz 
Filesize  7.33 KB 
Downloaded  28 Time(s) 
gettext_part3.tar.gz
Description 
gz

 Download 
Filename  gettext_part3.tar.gz 
Filesize  10.34 KB 
Downloaded  30 Time(s) 

Last edited by xanad on Fri 29 Aug 2014, 10:57; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 2 of 4 [57 Posts]   Goto page: Previous 1, 2, 3, 4 Next
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.4019s ][ Queries: 12 (0.0163s) ][ GZIP on ]