tazpkg diff tazpkg-notify @ rev 707

Finish translation converting; now strongly need to re-check translations using original files from translators.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Dec 13 16:31:09 2014 +0200 (2014-12-13)
parents 0daa5fc6754f
children 58f001f8e2bc
line diff
     1.1 --- a/tazpkg-notify	Sat Feb 22 17:35:36 2014 +0000
     1.2 +++ b/tazpkg-notify	Sat Dec 13 16:31:09 2014 +0200
     1.3 @@ -7,13 +7,13 @@
     1.4  # be run by the WM autostart script or ~/.xsession and needs a systray to
     1.5  # sit in like in LXpanel or Tint2.
     1.6  #
     1.7 -# Copyright (C) 2012 SliTaz GNU/Linux - GNU GPL v2
     1.8 +# Copyright (C) 2012-2014 SliTaz GNU/Linux - GNU GPL v2
     1.9  #
    1.10  # Authors : Christophe Lincoln <pankso@slitaz.org>
    1.11  #
    1.12  
    1.13  # I18n
    1.14 -. /usr/bin/gettext.sh
    1.15 +. /lib/libtaz.sh
    1.16  export TEXTDOMAIN='tazpkg'
    1.17  
    1.18  fifo=/tmp/$(basename $0).fifo
    1.19 @@ -22,15 +22,17 @@
    1.20  doc="file:///usr/share/doc/tazpkg/tazpkg.html"
    1.21  
    1.22  installed=$(ls $db/installed | wc -l)
    1.23 -num="<b>$installed</b>"
    1.24 -text="$(eval_ngettext \
    1.25 -		'$num installed package' \
    1.26 -		'$num installed packages' $installed)"
    1.27 +text="$(_p \
    1.28 +		'%s installed package' \
    1.29 +		'%s installed packages' $installed \
    1.30 +		"<b>$installed</b>")"
    1.31  icon="/usr/share/pixmaps/tazpkg.png"
    1.32  [ -f "$db/packages.list" ] && mtime=$(find $db/packages.list -mtime +10;)
    1.33  [ -f "$db/packages.up" ] && up=$(cat $db/packages.up | wc -l)
    1.34  
    1.35 +
    1.36  # Notification icon
    1.37 +
    1.38  listen() {
    1.39  	# Manage the I/O redirection from SHell
    1.40  	rm -f $fifo && mkfifo $fifo
    1.41 @@ -38,27 +40,31 @@
    1.42  	exec 3<> $fifo
    1.43  	# Notification icon
    1.44  	yad --notification --listen --image=$icon \
    1.45 -		--text="$(eval_gettext 'Checking packages lists - $text')" <&3
    1.46 +		--text="$(_ 'Checking packages lists - %s' $text)" <&3
    1.47  	# Clean-up
    1.48  	rm -f $fifo
    1.49  }
    1.50  
    1.51 +
    1.52  # Notification menu (right click)
    1.53 +
    1.54  menu() {
    1.55  	cat << EOT
    1.56  menu:\
    1.57 -$(gettext "My packages")!tazweb $panel?list!tazpkg|\
    1.58 -$(gettext "Recharge lists")!tazweb $panel?recharge!tazpkg-up|\
    1.59 -$(gettext "Check upgrade")!tazweb $panel?up!tazpkg-up|\
    1.60 -$(gettext "TazPkg SHell")!terminal -e tazpkg shell!xterm|\
    1.61 -$(gettext "TazPkg manual")!tazweb $doc!text-html|\
    1.62 -$(gettext "Close notification")!quit!gtk-close
    1.63 +$(_ 'My packages'       )!tazweb $panel?list!tazpkg|\
    1.64 +$(_ 'Recharge lists'    )!tazweb $panel?recharge!tazpkg-up|\
    1.65 +$(_ 'Check upgrade'     )!tazweb $panel?up!tazpkg-up|\
    1.66 +$(_ 'TazPkg SHell'      )!terminal -e tazpkg shell!xterm|\
    1.67 +$(_ 'TazPkg manual'     )!tazweb $doc!text-html|\
    1.68 +$(_ 'Close notification')!quit!gtk-close
    1.69  EOT
    1.70  }
    1.71  
    1.72 +
    1.73  case $1 in
    1.74  	usage|help|*-h)
    1.75 -		gettext "Usage:"; echo " $(basename $0)" ;;
    1.76 +		_ "Usage:"; echo " $(basename $0)"
    1.77 +		;;
    1.78  	*)
    1.79  		# Sleep before displaying the notification icon and
    1.80  		# sleep to let user read the tooltips.
    1.81 @@ -69,32 +75,36 @@
    1.82  		sleep 6
    1.83  		# Missing packages list
    1.84  		if [ ! -f $db/packages.list ]; then
    1.85 -			tooltip=$(eval_gettext 'No packages list found - $text')
    1.86 +			tooltip="$(_ 'No packages list found - %s' $text)"
    1.87  			echo "action:tazweb $panel?recharge" > $fifo
    1.88  			echo "tooltip:$tooltip" > $fifo
    1.89 -			echo "icon:tazpkg-up" > $fifo && exit 0
    1.90 +			echo "icon:tazpkg-up" > $fifo
    1.91 +			exit 0
    1.92  		fi
    1.93  		# Too old packages list
    1.94  		if [ "$mtime" ]; then
    1.95 -			tooltip=$(gettext "Your packages list is older than 10 days")
    1.96 +			tooltip="$(_ 'Your packages list is older than 10 days')"
    1.97  			echo "action:tazweb $panel?recharge" > $fifo
    1.98  			echo "tooltip:$tooltip" > $fifo
    1.99 -			echo "icon:tazpkg-up" > $fifo && exit 0
   1.100 +			echo "icon:tazpkg-up" > $fifo
   1.101 +			exit 0
   1.102  		fi
   1.103  		# Available upgrades
   1.104  		if [ "$up" -gt 0 ]; then
   1.105 -			num="<b>$up</b>"
   1.106 -			tooltip=$(eval_ngettext \
   1.107 -				'There is $num upgradeable package' \
   1.108 -				'There are $num upgradeable packages' $up)
   1.109 +			tooltip="$(_p \
   1.110 +				'There is %s upgradeable package' \
   1.111 +				'There are %s upgradeable packages' $up \
   1.112 +				"<b>$up</b>")"
   1.113  			echo "action:tazweb $panel?up" > $fifo
   1.114  			echo "tooltip:$tooltip" > $fifo
   1.115 -			echo "icon:tazpkg-up" > $fifo && exit 0
   1.116 +			echo "icon:tazpkg-up" > $fifo
   1.117 +			exit 0
   1.118  		fi
   1.119  		# Nothing to do, close notification
   1.120 -		tooltip=$(eval_gettext 'System is up to date - $text')
   1.121 +		tooltip="$(_ 'System is up to date - %s' $text)"
   1.122  		echo "tooltip:$tooltip" > $fifo
   1.123  		sleep 10
   1.124 -		echo "quit" > $fifo ;;
   1.125 +		echo "quit" > $fifo
   1.126 +		;;
   1.127  esac
   1.128  exit 0