#!/bin/sh
# i18n_head - i18n support with gettext on petget
# 20aug10 by shinobar(Masaki Shinomiya) <shino@pos.to>
# 2jan10 shhinobar: local function eval_gettext and download_file for portability

export TEXTDOMAIN=dotpup
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8

# eval_gettext MSGID
# looks up the translation of MSGID and substitutes shell variables in the
# result.
eval_gettext () {
  local myMESSAGE=$(gettext "$1")
  eval echo \"$myMESSAGE\"
}

GETTEXTSH=$(which gettext.sh)
which envsubst &>/dev/null || GETTEXTSH=""	# required prog. not found
[ -s "$GETTEXTSH" ] && . "$GETTEXTSH"

export LANG_USER=$LANG
export RXVT=urxvt
which $RXVT &>/dev/null || RXVT=rxvt
export T_title="`gettext \"Package Manager\"`"

DOWNLOADFILE=$(which download_file)
if [ "$DOWNLOADFILE" = "" ]; then
#rxvt -title "Puppy Package Manager: download" -bg orange -fg black -geometry 80x10 -e wget ${DOWNLOADFROM}/${ONEFILE}
#download_file ${DOWNLOADFROM}/${ONEFILE}
  download_file() {
	  $RXVT -title "$T_title" -bg orange -fg black -geometry 80x10 -e wget "$1"
  }
fi
export X1PID
mysplash() {
	if which gtkdialog-splash &>/dev/null ; then
	  LANG=$LANG_USER gtkdialog-splash -fontsize "large" -icon "gtk-info" --placement center -bg orange -text "$@" &
	else
	  LANG=$LANG_USER gxmessage -center -wrap -bg orange -title "$T_title" -buttons '' -nofocus "$@" &
	fi
	export X1PID=$!
}