Woof2
Artifact Content
Not logged in

Artifact bd2e85fdab0c0a49b6ac0d6aaef12e37de6f1440


#!/bin/sh
#(c) Barry Kauler Feb 2012 bkhome.org
#licence GPL3 refer /usr/share/doc/legal
#the intention of this script is to manage non-english translations of files.
#this is to include shell scripts, xml, .desktop and menu files.
#translation will only be for the current language, and UTF-8 must be enabled.
#120205 first release, handle gettext'ed scripts.
#120206 added internationalization management of menu.
#120206 simplify gui with help buttons.
#120206 add management of menu categories.
#120207 write translations to a folder in /root with full path, write.log, generate tarball.
#120208 support SSS domains. (read comments in /usr/share/sss/menu_strings/menu_strings for more info)
#120208 sync translated sss-file with master sss-file.
#120209 desk_strings domain translates target files in-place, so need workaround when edit TRANSLATION variables in desk_strings.*
#120209 ...ditto for script_strings
#120210 add handling XML files.
#120212 some tweaks.
#120213 rodin.s: xgettext does not work properly on alsaconf script, use ready-made alsaconf.pot (in Woof).
#120213 added management of binary executables.
#120214 generate a langpack PET package.
#120215 added management of initrd files (initrd_strings SSS domain).
#120217 small message fixes.
#120217 support poeditor.
#120218 LANG=${ORIGLANG} prefix needed various places.

#***MOMANAGER IS ENGLISH ONLY (NOT GETTEXT'ED)***
#it is for use by developers/translators with knowledge of english.

PARAM1=""
[ $1 ] && PARAM1="$1"

ORIGLANG=$LANG
export LANG=C
. /etc/rc.d/PUPSTATE
GTKDIALOGEXE="gtkdialog"
[ "`which gtkdialog4`" ] && GTKDIALOGEXE="gtkdialog4"
mkdir -p /tmp/momanager
ADATE="`date +%Y%m%d`" #ex: 20120205
WINICON="gtk-preferences"; HELPICON="gtk-index" #gtk-info

ORIGLANG1="`echo -n $ORIGLANG | cut -f 1 -d '_'`"  #ex: de
ORIGLANG12="`echo -n $ORIGLANG | cut -f 1 -d '.'`" #ex: de_DE

if [ "$ORIGLANG1" = "en" ];then
 pupdialog --title "MoManager: abort" --background pink --colors --msgbox "This application is intended for creation and editing of non-English translations of scripts, but your locale is currently \Zb${ORIGLANG}\ZB. Click the \Zbsetup\ZB icon on the desktop to change locale (and be sure to enable UTF-8). Aborting." 0 0
 exit 1
fi
if [ "`echo -n $ORIGLANG | grep -i 'utf'`" = "" ];then
 pupdialog --title "MoManager: abort" --background pink --colors --msgbox "Sorry, your \Zblocale\ZB (language) must have UTF-8 enabled to use this application. Click the \Zbsetup\ZB icon on the desktop to change locale. Aborting." 0 0
 exit 1
fi
if [ "`which gcc`" = "" ];then
 pupdialog --title "MoManager: abort" --background pink --colors --msgbox "Sorry, you must have the \Zbdevx\ZB SFS loaded. Aborting." 0 0
 exit 1
fi
MISSINGFILE=""
[ "`which intltool-update`" = "" ] && MISSINGFILE="intltool-update "
[ "`which xgettext`" = "" ] && MISSINGFILE="${MISSINGFILE}xgettext "
[ "`which msginit`" = "" ] && MISSINGFILE="${MISSINGFILE}msginit "
[ "`which msgfmt`" = "" ] && MISSINGFILE="${MISSINGFILE}msgfmt "
[ "`which msgunfmt`" = "" ] && MISSINGFILE="${MISSINGFILE}msgunfmt"
if [ "$MISSINGFILE" ];then
 pupdialog --title "MoManager: abort" --background pink --colors --msgbox "Sorry, these needed applications are missing: \Zb${MISSINGFILE}\ZB. The \Zbdevx\ZB SFS normally has these, but it must be incomplete. Aborting." 0 0
 exit 1
fi

POEDITOR="`which poeditor`"
[ ! "$POEDITOR" ] && POEDITOR="`which poedit`"

PATHPREFIX=""
case $PUPMODE in
 2) PATHPREFIX="" ;; #full hd installation.
 3) PATHPREFIX="" ;;
 *) PATHPREFIX="/initrd/pup_ro2" ;;
esac
if [ "$PATHPREFIX" = "" ];then
 pupdialog --title "MoManager: abort" --background pink --msgbox "Sorry, the PUPMODE must be a value greater than 3, that is, not be a full hd installation. Aborting." 0 0
 exit 1
fi
ppPTN="s%${PATHPREFIX}%%"

#download woof, to get latest files... no, too difficult, just put up warning...
export MM1_DLG="<window title=\"MoManager: welcome\" window_position=\"1\" resizable=\"false\" icon-name=\"${WINICON}\">
 <vbox>
  <text><label>Welcome, MoManager will help you to create and edit language translations for your country, for many of the applications in Puppy. MoManager only handles shell scripts and some XML data and .desktop menu files, binary compiled executables are not handled.</label></text>
  <text><label>VERY IMPORTANT: You must be currently running a Puppy built from the latest version of Woof, or very near latest. If your Puppy is even a month old, it is recommended that you check for a later release -- and be sure that it is built from the latest Woof. You can check my blog (bkhome.org/blog) for release announcements, or adventurous developers can even download Woof and build their own Puppy (the online Woof repository at bkhome.org/fossil/woof2.cgi has link to instructions)</label></text>
  <text><label>If you are currently running a very recent Woof-built Puppy, then click the 'OK' button to continue running MoManager:</label></text>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
 </vbox>
</window>
"
if [ ! "$PARAM1" ];then #on reentry, bypass this window.
 MM1RET="`$GTKDIALOGEXE --program=MM1_DLG`"
 [ "`echo "$MM1RET" | grep 'OK'`" = "" ] && exit 2
fi

yaf-splash -close never -bg orange -text "Please wait, scanning files..." &
yPID=$!

echo -n "" > /tmp/momanager/translations4langpack #to create the langpack PET.
TRANSLANG=""

#####SCRIPTS#######
#find all gettext'ed scripts...
#GETTEXTSCRIPTS="`find ${PATHPREFIX}/bin ${PATHPREFIX}/sbin ${PATHPREFIX}/usr/bin ${PATHPREFIX}/usr/sbin ${PATHPREFIX}/usr/X11R7/bin ${PATHPREFIX}/usr/local ${PATHPREFIX}/etc/rc.d -maxdepth 4 -type f -executable | xargs -I INPUTFILE grep --files-with-matches '^export TEXTDOMAIN=' INPUTFILE | sed -e 's% %SPACECHAR%g' -e "$ppPTN" | sort | tr '\n' ' '`"
GETTEXTSCRIPTS="`find /bin /sbin /usr/bin /usr/sbin /usr/X11R7/bin /usr/local /etc/rc.d /root/my-applications/bin -maxdepth 4 -type f -executable | xargs -I INPUTFILE grep --files-with-matches '^export TEXTDOMAIN=' INPUTFILE | sed -e 's% %SPACECHAR%g' | sort | tr '\n' ' '`"

#find all matching .mo files...
YESCNT=0; NOCNT=0; YESMO_XML=""; NOMO_XML=""
for AGTS in $GETTEXTSCRIPTS
do
 xAGTS="`echo -n $AGTS | sed -e 's%SPACECHAR% %g'`"
 TEXTDOMAINVALUE="`grep '^export TEXTDOMAIN=' "$xAGTS" | cut -f 2 -d '=' | tr '\t' ' ' | cut -f 1 -d ' '`"

 #want to know if from Woof or a builtin pkg or later-installed pkg...
 BASExAGTS="`basename "$xAGTS"`"
 xPTN=" ${BASExAGTS}$"
 PATHxAGTS="`dirname "$xAGTS"`"
 xxPTN="^${PATHxAGTS}$"
 zPTN="^${xAGTS}$"
 aPKGNAME="`grep "$xPTN" /root/.packages/builtin_files/* | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev`" #test if pkg used in Woof build.
 if [ "$aPKGNAME" ];then #confirm full path.
  for AAA in $aPKGNAME
  do
   CONFIRM="`cat /root/.packages/builtin_files/${AAA} | sed -e 's%^ %/%' | tr -d '\n' | grep "$xAGTS"`"
   if [ "$CONFIRM" ];then
    aPKGNAME="$AAA"
    break
   fi
  done
  [ ! "$CONFIRM" ] && aPKGNAME=""
 fi
 [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg.
 #...return nothing if in Woof
 [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${xAGTS}" ] && aPKGNAME="WOOF" #file is in Woof.
 [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"

 FNDMO=""
 if [ -f /usr/share/locale/${ORIGLANG12}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo ];then
  FNDMO="/usr/share/locale/${ORIGLANG12}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo"
  TRANSLANG=$ORIGLANG12
 else
  if [ -f /usr/share/locale/${ORIGLANG1}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo ];then
   FNDMO="/usr/share/locale/${ORIGLANG1}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo"
   TRANSLANG=$ORIGLANG1
  fi
 fi
 if [ "$FNDMO" ];then
  YESCNT=$(($YESCNT + 1))
  YESMO_XML="${YESMO_XML}
<item>${xAGTS} (${TRANSLANG} ${TEXTDOMAINVALUE}.mo ${aPKGNAME})</item>"
  echo "$FNDMO" >> /tmp/momanager/translations4langpack
 else
  NOCNT=$(($NOCNT + 1))
#  NOMO_XML="${NOMO_XML}
#<radiobutton><variable>NORAD${NOCNT}</variable><label>${xAGTS}</label></radiobutton>"
  NOMO_XML="${NOMO_XML}
<item>${xAGTS} (${TEXTDOMAINVALUE} ${aPKGNAME})</item>"
 fi
done
if [ "$YESMO_XML" ];then
 YESMO_XML="<combobox width-request=\"310\"><variable>YESMO_COMBO</variable>${YESMO_XML}</combobox>"
else
 #YESMO_XML="<text><label>nothing</label></text>"
 YESMO_XML="<combobox width-request=\"310\"><variable>EMPTYYESMO_COMBO</variable><item>--empty--</item></combobox>"
fi
if [ "$NOMO_XML" ];then
 NOMO_XML="<combobox width-request=\"330\"><variable>NOMO_COMBO</variable>${NOMO_XML}</combobox>"
else
 #NOMO_XML="<text><label>nothing</label></text>"
 NOMO_XML="<combobox width-request=\"330\"><variable>EMPTYNOMO_COMBO</variable><item>--empty--</item></combobox>"
fi

#######MENU ENTRIES#######
#find out which .desktop files have [lang] entries already, create two lists...
YESDESK_XML=""; NODESK_XML=""
dPTN="\\[${ORIGLANG1}\\]"
for ADESKTOP in `find /usr/share/applications -mindepth 1 -maxdepth 1 -type f -name '*.desktop' | grep -v ' ' | sort | tr '\n' ' '`
do
 [ "`grep '^Icon' $ADESKTOP`" = "" ] && continue #some dummy .desktop files used by xfce, ignore them.
 ADESKNAME="`basename $ADESKTOP`"
 
 #find out what package it is from...
 xPTN=" ${ADESKNAME}$"
 zPTN="^${ADESKTOP}$"
 aPKGNAME="`grep "$xPTN" /root/.packages/builtin_files/* | head -n 1 | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev`" #test if pkg used in Woof build.
 [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg.
 #...return nothing if in Woof
 [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${ADESKTOP}" ] && aPKGNAME="WOOF" #file is in Woof.
 [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
 
 if [ "`grep "$dPTN" $ADESKTOP`" != "" ];then
  YESDESK_XML="${YESDESK_XML}
<item>${ADESKNAME} (${aPKGNAME})</item>"
  echo "$ADESKTOP" >> /tmp/momanager/translations4langpack
 else
  NODESK_XML="${NODESK_XML}
<item>${ADESKNAME} (${aPKGNAME})</item>"
 fi
done
if [ "$YESDESK_XML" ];then
 YESDESK_XML="<combobox width-request=\"310\"><variable>YESDESK_COMBO</variable>${YESDESK_XML}</combobox>"
else
 #YESDESK_XML="<text><label>nothing</label></text>"
 YESDESK_XML="<combobox width-request=\"310\"><variable>EMPTYYESDESK_COMBO</variable><item>--empty--</item></combobox>"
fi
if [ "$NODESK_XML" ];then
 NODESK_XML="<combobox width-request=\"330\"><variable>NODESK_COMBO</variable>${NODESK_XML}</combobox>"
else
 #NODESK_XML="<text><label>nothing</label></text>"
 NODESK_XML="<combobox width-request=\"330\"><variable>EMPTYNODESK_COMBO</variable><item>--empty--</item></combobox>"
fi

#help buttons...
YESMO_HELP_MSG="Puppy has many <b>scripts</b>, applications that are plain text files, usually written in Bash or Ash. These scripts all have English capability, but language translation files may be created for them, known as <b>mo</b> files.
The drop-down list is a list of scripts for which there is a mo translation file in your language.
The drop-down list has extra information in brackets, in the format <b>(lang TEXTDOMAIN package)</b>. In particular, package=WOOF means the file is in Woof, or the name of the package from which the file comes is given, or if not known then package=UNKNOWN.
A mo translation file in your language (${ORIGLANG12}) is at /usr/share/locale/${ORIGLANG12}/LC_MESSAGES/ or /usr/share/locale/${ORIGLANG1}/LC_MESSAGES/. You may select one of the scripts, then click the <b>Edit</b> button to update it.
Updating is required if the translation is incorrect or incomplete in any way. One reason this can happen is if there is a later version of the script with some changed English text strings."
export DLG_HELP_YESMO="<window resizable=\"false\" title=\"MoManager: Help edit mo files\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${YESMO_HELP_MSG}\"</label><variable>VAR_HELP_YESMO</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_YESMO</action></button></hbox></vbox></window>"
YESMOHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_YESMO</action></button>'

NOMO_HELP_MSG="Puppy has many <b>scripts</b>, applications that are plain text files, usually written in Bash or Ash. These scripts all have English capability, but language translation files may be created for them, known as <b>mo</b> files.
The drop-down list is a list of scripts for which there is no mo translation file in your language.
The drop-down list has extra information in brackets, in the format <b>(TEXTDOMAIN package)</b>. In particular, package=WOOF means the file is in Woof, or the name of the package from which the file comes is given, or if not known then package=UNKNOWN.
To create a translation file, select a script from the list, then click the <b>Create</b> button. This will open a file in a text editor which has all the English strings from the script, and below each you type in your translations. This file is known as a <b>po</b> file, and after saving and quiting the text editor, the file will be compiled into a binary format known as a <b>mo</b> file -- note, po files have a filename ending in .po and mo files end in .mo. It is the mo file that the script will use when it runs."
export DLG_HELP_NOMO="<window resizable=\"false\" title=\"MoManager: Help create mo files\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${NOMO_HELP_MSG}\"</label><variable>VAR_HELP_NOMO</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_NOMO</action></button></hbox></vbox></window>"
NOMOHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_NOMO</action></button>'

YESDESK_HELP_MSG="The drop-down list is of .desktop files in /usr/share/applications, that have translations for your language.
The <b>Name[${ORIGLANG1}]</b> entry in these files is what you see when you click on the Menu button at bottom-left of the screen (in some puppies the menu button is placed elsewhere). There will be a translation for each application.
If you need to correct an entry, select the appropriate .desktop file, then click the <b>Edit</b> button.
Note, The drop-down list has extra information in brackets, which is the name of the package that the file belongs to. <b>WOOF</b> means that the file is in Woof."
export DLG_HELP_YESDESK="<window resizable=\"false\" title=\"MoManager: Help edit menu entries\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${YESDESK_HELP_MSG}\"</label><variable>VAR_HELP_YESDESK</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_YESDESK</action></button></hbox></vbox></window>"
YESDESKHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_YESDESK</action></button>'

NODESK_HELP_MSG="The drop-down list is of .desktop files in /usr/share/applications, that do <i>not</i> have translations for your language.
The <b>Name[${ORIGLANG1}]</b> entry in these files is what you see when you click on the Menu button at bottom-left of the screen (in some puppies the menu button is placed elsewhere). There will be a translation for each application, but for these .desktop files there is no translation, so the entries will display in English.
If you wish to create a translation, select the appropriate .desktop file, then click the <b>Create</b> button.
Note, The drop-down list has extra information in brackets, which is the name of the package that the file belongs to. <b>WOOF</b> means that the file is in Woof."
export DLG_HELP_NODESK="<window resizable=\"false\" title=\"MoManager: Help create menu entries\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${NODESK_HELP_MSG}\"</label><variable>VAR_HELP_NODESK</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_NODESK</action></button></hbox></vbox></window>"
NODESKHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_NODESK</action></button>'

#######MENU TITLES#######
#this gives us the list of .directory files in /usr/share/desktop-directories for the top-level titles... ex: Puppy-Setup.directory
TOPMENUFILES="`grep -m1 '<Directory>' /etc/xdg/menus/puppy-[^S]*.menu | cut -f 2 -d '>' | cut -f 1 -d '<' | grep 'directory$' | sort | tr '\n' ' '`"
YESTOP_XML=""; NOTOP_XML=""
dPTN="^Name\\[${ORIGLANG1}\\]"
for ATOPMENUFILE in $TOPMENUFILES
do
 if [ "`grep "$dPTN" /usr/share/desktop-directories/$ATOPMENUFILE`" != "" ];then
  #there is already a translation.
  YESTOP_XML="${YESTOP_XML}
<item>${ATOPMENUFILE}</item>"
  echo "/usr/share/desktop-directories/${ATOPMENUFILE}" >> /tmp/momanager/translations4langpack
 else
  NOTOP_XML="${NOTOP_XML}
<item>${ATOPMENUFILE}</item>"
 fi
done
if [ "$YESTOP_XML" ];then
 YESTOP_XML="<combobox width-request=\"310\"><variable>YESTOP_COMBO</variable>${YESTOP_XML}</combobox>"
else
 #YESTOP_XML="<text><label>nothing</label></text>"
 YESTOP_XML="<combobox width-request=\"310\"><variable>EMPTYYESTOP_COMBO</variable><item>--empty--</item></combobox>"
fi
if [ "$NOTOP_XML" ];then
 NOTOP_XML="<combobox width-request=\"330\"><variable>NOTOP_COMBO</variable>${NOTOP_XML}</combobox>"
else
 #NOTOP_XML="<text><label>nothing</label></text>"
 NOTOP_XML="<combobox width-request=\"330\"><variable>EMPTYNOTOP_COMBO</variable><item>--empty--</item></combobox>"
fi
#help buttons...
YESTOP_HELP_MSG="These are the top-level menu titles, or categories, that you see when you click on the 'Menu' button at bottom-left of the screen (or elsewhere in some puppies). The drop-down list is for those categories that already have a translation for the <b>${ORIGLANG1}</b> locale.
If you wish to change a translation, select a file from the drop-down list, then click the <b>Edit</b> button. A text editor will open, then edit the <b>Name[${ORIGLANG1}]</b> entry, then save and quit the editor. Afterward, the menu will refresh and you will be able to see the change."
export DLG_HELP_YESTOP="<window resizable=\"false\" title=\"MoManager: Help edit menu categories\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${YESTOP_HELP_MSG}\"</label><variable>VAR_HELP_YESTOP</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_YESTOP</action></button></hbox></vbox></window>"
YESTOPHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_YESTOP</action></button>'
NOTOP_HELP_MSG="These are the top-level menu titles, or categories, that you see when you click on the 'Menu' button at bottom-left of the screen (or elsewhere in some puppies). The drop-down list is for those categories that do <i>not</i> have a translation for the <b>${ORIGLANG1}</b> locale (so they will display in English).
If you wish to create a translation, select a file from the drop-down list, click the <b>Create</b> button. A text editor will open, then edit the <b>Name[${ORIGLANG1}]</b> entry, then save and quit the editor. Afterward, the menu will refresh and you will be able to see the change."
export DLG_HELP_NOTOP="<window resizable=\"false\" title=\"MoManager: Help edit menu categories\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${NOTOP_HELP_MSG}\"</label><variable>VAR_HELP_NOTOP</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_NOTOP</action></button></hbox></vbox></window>"
NOTOPHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_NOTOP</action></button>'

#######XML#######
#search $PATHPREFIX to avoid devx files...
YESXML_XML='' ; NOXML_XML=''
#XMLFILES="`find ${PATHPREFIX}/usr/local -type f -name '*.xml' | sed "s%^${PATHPREFIX}%%" | sed -e 's% %SPACECHAR%g' | tr '\n' ' '`" #ex: /usr/local/apps/Connect/AppInfo.xml
XMLFILES="`find /usr/local -type f -name '*.xml' | sed -e 's% %SPACECHAR%g' | tr '\n' ' '`" #ex: /usr/local/apps/Connect/AppInfo.xml
aPTN="xml:lang=\"${ORIGLANG1}\""  #ex: xml:lang="de"
bPTN="xml:lang=\"${ORIGLANG12}\"" #ex: xml:lang="de_DE"
for AXMLFILE in $XMLFILES
do
 AXMLFILE="`echo -n "$AXMLFILE" | sed -e 's%SPACECHAR% %g'`"
 
 #want to know if from Woof or a builtin pkg or later-installed pkg...
 BASEAXMLFILE="`basename "$AXMLFILE"`"
 xPTN=" ${BASEAXMLFILE}$"
 PATHAXMLFILE="`dirname "$AXMLFILE"`"
 xxPTN="^${PATHAXMLFILE}$"
 zPTN="^${AXMLFILE}$"
 aPKGNAME="`grep "$xPTN" /root/.packages/builtin_files/* | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev`" #test if pkg used in Woof build.
 if [ "$aPKGNAME" ];then #confirm full path.
  for AAA in $aPKGNAME
  do
   CONFIRM="`cat /root/.packages/builtin_files/${AAA} | sed -e 's%^ %/%' | tr -d '\n' | grep "$AXMLFILE"`"
   if [ "$CONFIRM" ];then
    aPKGNAME="$AAA"
    break
   fi
  done
  [ ! "$CONFIRM" ] && aPKGNAME=""
 fi
 [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg.
 #...return nothing if in Woof
 [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${AXMLFILE}" ] && aPKGNAME="WOOF" #file is in Woof.
 [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
 
 FNDFLAG=''
 FNDFLAG="`grep "$aPTN" "$AXMLFILE"`"
 [ ! "$FNDFLAG" ] && FNDFLAG="`grep "$bPTN" "$AXMLFILE"`"
 if [ "$FNDFLAG" ];then
  #there is already a translation.
  YESXML_XML="${YESXML_XML}
<item>${AXMLFILE} (${aPKGNAME})</item>"
  echo "${AXMLFILE}" >> /tmp/momanager/translations4langpack
 else
  NOXML_XML="${NOXML_XML}
<item>${AXMLFILE} (${aPKGNAME})</item>"
 fi
done
if [ "$YESXML_XML" ];then
 YESXML_XML="<combobox width-request=\"310\"><variable>YESXML_COMBO</variable>${YESXML_XML}</combobox>"
else
 YESXML_XML="<combobox width-request=\"310\"><variable>EMPTYYESXML_COMBO</variable><item>--empty--</item></combobox>"
fi
if [ "$NOXML_XML" ];then
 NOXML_XML="<combobox width-request=\"330\"><variable>NOXML_COMBO</variable>${NOXML_XML}</combobox>"
else
 NOXML_XML="<combobox width-request=\"330\"><variable>EMPTYNOXML_COMBO</variable><item>--empty--</item></combobox>"
fi
#help buttons...
XML_COM_HELP="XML files are a form of structured data that applications (such as ROX-Filer) may use, and they may contain text that the application displays on-screen. The XML specification has a standard notation for text strings in different languages, using the <b>xml:lang</b> attribute. For example:

 &lt;Label&gt;Connect to the Internet now&lt;/Label&gt;
 &lt;Label xml:lang="ru"&gt;Подключиться к Интернет сейчас&lt;/Label&gt;
 &lt;Label xml:lang="ja"&gt;インターネット接続ウィザードを実行&lt;/Label&gt;
 &lt;Label xml:lang="zh_CN"&gt;运行互联网连接向导&lt;/Label&gt;"
YESXML_HELP_MSG="${XML_COM_HELP}

The XML files in the drop-down list already have xml:lang translations for your <b>${ORIGLANG12}</b> locale, however they might not be correct or complete so should be reviewed. Please select a file, then click the <b>Edit</b> button.
Note, the brackets alongside each filename in the drop-down list contains the name of the package that the file comes from -- WOOF means that the file comes from Woof."
export DLG_HELP_YESXML="<window resizable=\"false\" title=\"MoManager: Help edit XML files\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\" width-chars=\"70\"><label>\"${YESXML_HELP_MSG}\"</label><variable>VAR_HELP_YESXML</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_YESXML</action></button></hbox></vbox></window>"
YESXMLHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_YESXML</action></button>'
NOXML_HELP_MSG="${XML_COM_HELP}

The XML files in the drop-down list do <i>not</i> have xml:lang translations for your <b>${ORIGLANG12}</b> locale. You will need to determine where the translations are to be inserted. Please select a file, then click the <b>Create</b> button.
Note, the brackets alongside each filename in the drop-down list contains the name of the package that the file comes from -- WOOF means that the file comes from Woof."
export DLG_HELP_NOXML="<window resizable=\"false\" title=\"MoManager: Help edit XML files\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\" width-chars=\"70\"><label>\"${NOXML_HELP_MSG}\"</label><variable>VAR_HELP_NOXML</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_NOXML</action></button></hbox></vbox></window>"
NOXMLHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_NOXML</action></button>'

#######SSS#######
#Simple String Substitution
#manage translations in many non-executable data files.
#translations are kept in /usr/share/sss/$SSSDOMAIN/$SSSDOMAIN.$ORIGLANG1 ex: SSSDOMAIN=menu_strings ORIGLANG1=de
YESSSS_XML=""; NOSSS_XML=""
for ASSSDOMAIN in `find /usr/share/sss -mindepth 1 -maxdepth 1 -type d | sed -e 's%^/usr/share/sss/%%' | tr '\n' ' '`
do
 if [ -f /usr/share/sss/${ASSSDOMAIN}/${ASSSDOMAIN}.${ORIGLANG1} ];then
  #there is already a translation.
  YESSSS_XML="${YESSSS_XML}
<item>${ASSSDOMAIN}.${ORIGLANG1}</item>"
  echo "/usr/share/sss/${ASSSDOMAIN}/${ASSSDOMAIN}.${ORIGLANG1}" >> /tmp/momanager/translations4langpack
 else
  NOSSS_XML="${NOSSS_XML}
<item>${ASSSDOMAIN}</item>"
 fi
done
if [ "$YESSSS_XML" ];then
 YESSSS_XML="<combobox width-request=\"310\"><variable>YESSSS_COMBO</variable>${YESSSS_XML}</combobox>"
else
 YESSSS_XML="<combobox width-request=\"310\"><variable>EMPTYYESSSS_COMBO</variable><item>--empty--</item></combobox>"
fi
if [ "$NOSSS_XML" ];then
 NOSSS_XML="<combobox width-request=\"330\"><variable>NOSSS_COMBO</variable>${NOSSS_XML}</combobox>"
else
 NOSSS_XML="<combobox width-request=\"330\"><variable>EMPTYNOSSS_COMBO</variable><item>--empty--</item></combobox>"
fi
#help buttons...
SSS_DOMAINS_MSG="
<b>menu_strings</b>
These are translations for window manager and tray data files. For example, the JWM window manager has a data file /root/.jwmrc, which has some strings that appear in on-screen menus (apart from the main application menu).

<b>desk_strings</b>
These are translations for any text data-files that have some text that displays on-screen.

<b>script_strings</b>
These are translations for scripts. The SSS method works on original scripts (in any language, ex: Bash, Lua, Perl, Tcl), whereas the gettext and t12s methods require editing of the script (however, gettext is a much more powerful translation technique).

<b>initrd_strings</b>
These are translations for files in the initrd (also known as the initramfs). This is a bit different from the other SSS domains, as the target files are translated at bootup, every bootup."
YESSSS_HELP_MSG="<b>SSS</b> means Simple String Substitution, a simple method of language translation for any type of text files. Files are translated in-place, that is, the original English files are replaced by the translated files -- this is translation <i>before</i> execution, as opposed to gettext which is run-time translation. An <b>SSS domain</b> defines a class of files that need to be translated. The drop-down list contains domains that have <b>${ORIGLANG1}</b> translations, however do check them as the translations may be incomplete. The headings below are the various domains:
${SSS_DOMAINS_MSG}"
export DLG_HELP_YESSSS="<window resizable=\"false\" title=\"MoManager: Help edit SSS domains\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${YESSSS_HELP_MSG}\"</label><variable>VAR_HELP_YESSSS</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_YESSSS</action></button></hbox></vbox></window>"
YESSSSHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_YESSSS</action></button>'
NOSSS_HELP_MSG="<b>SSS</b> means Simple String Substitution, a simple method of language translation for any type of text files. Files are translated in-place, that is, the original English files are replaced by the translated files -- this is translation <i>before</i> execution, as opposed to gettext which is run-time translation. An <b>SSS domain</b> defines a class of files that need to be translated. The drop-down list contains domains that do <i>not</i> have <b>${ORIGLANG1}</b> translations (so any on-screen text will be in English). The headings below are the various domains:
${SSS_DOMAINS_MSG}"
export DLG_HELP_NOSSS="<window resizable=\"false\" title=\"MoManager: Help create SSS domains\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${NOSSS_HELP_MSG}\"</label><variable>VAR_HELP_NOSSS</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_NOSSS</action></button></hbox></vbox></window>"
NOSSSHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_NOSSS</action></button>'

########Binary executables#######
#support a limited number of binary executables that have .pot files in /usr/share/doc/nls
YESCNT=0 ; NOCNT=0 ; YESBIN_XML="" ; NOBIN_XML=""
for ANLSDIR in `ls -1 /usr/share/doc/nls | tr '\n' ' '`
do
 if [ -d  /usr/share/doc/nls/${ANLSDIR} ];then
  BINEXEC=""
  BINEXEC="`which $ANLSDIR`"
  [ ! "$BINEXEC" ] && BINEXEC="`find /usr/local -maxdepth 4 -executable -type f -name "$ANLSDIR"`" #ex: /usr/local/simple_network_setup/proxy-setup
  if [ "$BINEXEC" ];then
   if [ "`file "$BINEXEC" | grep ' ELF ' | grep 'LSB executable'`" != "" ];then
    #have found binary executable for the pot file...
    TEXTDOMAINVALUE="$ANLSDIR" #TEXTDOMAIN must be same as executable name.
    
    #want to know if from Woof or a builtin pkg or later-installed pkg...
    BASEBINEXEC="`basename "$BINEXEC"`"
    xPTN=" ${BASEBINEXEC}$"
    PATHBINEXEC="`dirname "$BINEXEC"`"
    xxPTN="^${PATHBINEXEC}$"
    zPTN="^${BINEXEC}$"
    aPKGNAME="`grep "$xPTN" /root/.packages/builtin_files/* | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev`" #test if pkg used in Woof build.
    if [ "$aPKGNAME" ];then #confirm full path.
     for AAA in $aPKGNAME
     do
      CONFIRM="`cat /root/.packages/builtin_files/${AAA} | sed -e 's%^ %/%' | tr -d '\n' | grep "$BINEXEC"`"
      if [ "$CONFIRM" ];then
       aPKGNAME="$AAA"
       break
      fi
     done
     [ ! "$CONFIRM" ] && aPKGNAME=""
    fi
    [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg.
    #...return nothing if in Woof
    [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${BINEXEC}" ] && aPKGNAME="WOOF" #file is in Woof.
    [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
    
    FNDMO=""
    if [ -f /usr/share/locale/${ORIGLANG12}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo ];then
     FNDMO="/usr/share/locale/${ORIGLANG12}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo"
     TRANSLANG=$ORIGLANG12
    else
     if [ -f /usr/share/locale/${ORIGLANG1}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo ];then
      FNDMO="/usr/share/locale/${ORIGLANG1}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo"
      TRANSLANG=$ORIGLANG1
     fi
    fi
    if [ "$FNDMO" ];then
     YESCNT=$(($YESCNT + 1))
     YESBIN_XML="${YESBIN_XML}
<item>${BINEXEC} (${TRANSLANG} ${TEXTDOMAINVALUE}.mo ${aPKGNAME})</item>"
     echo "/usr/share/locale/${TRANSLANG}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo" >> /tmp/momanager/translations4langpack
    else
     NOCNT=$(($NOCNT + 1))
     NOBIN_XML="${NOBIN_XML}
<item>${BINEXEC} (${TEXTDOMAINVALUE} ${aPKGNAME})</item>"
    fi
    
   fi
  fi
 fi
done
if [ "$YESBIN_XML" ];then
 YESBIN_XML="<combobox width-request=\"310\"><variable>YESBIN_COMBO</variable>${YESBIN_XML}</combobox>"
else
 YESBIN_XML="<combobox width-request=\"310\"><variable>EMPTYYESBIN_COMBO</variable><item>--empty--</item></combobox>"
fi
if [ "$NOBIN_XML" ];then
 NOBIN_XML="<combobox width-request=\"330\"><variable>NOBIN_COMBO</variable>${NOBIN_XML}</combobox>"
else
 NOBIN_XML="<combobox width-request=\"330\"><variable>EMPTYNOBIN_COMBO</variable><item>--empty--</item></combobox>"
fi
#help buttons...
YESBIN_HELP_MSG="MoManager provides translation support for a limited number of binary executables. These are executables in Woof or in PET packages, that have <b>pot</b> files at /usr/share/doc/nls. The drop-down list is of binary executables that already have a ${ORIGLANG1} or ${ORIGLANG12} translation, but you may wish to review the translations, especially if the version of the binary executable has changed. Select a file, then click the <b>Edit</b> button.

The drop-down list has extra information in brackets, in the format <b>(lang TEXTDOMAIN package)</b>. In particular, package=WOOF means the file is in Woof, or the name of the package from which the file comes is given, or if not known then package=UNKNOWN.

A <b>pot</b> file is a translation template file. MoManager converts it to a <b>po</b> file, which is an editable form for your language, and it is finally compiled to a <b>mo</b> file and placed at /usr/share/locale.

There are many other binary executable applications in Puppy that are not managed by MoManager. For those, for example the Abiword word processor, the author of the application provides translations. In many cases you can find a nls translation package for an application via the Puppy Package Manager."
export DLG_HELP_YESBIN="<window resizable=\"false\" title=\"MoManager: Help edit mo files\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${YESBIN_HELP_MSG}\"</label><variable>VAR_HELP_YESBIN</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_YESBIN</action></button></hbox></vbox></window>"
YESBINHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_YESBIN</action></button>'
NOBIN_HELP_MSG="MoManager provides translation support for a limited number of binary executables. These are executables in Woof or in PET packages, that have <b>pot</b> files at /usr/share/doc/nls. The drop-down list is of binary executables that do <i>not</i> have a ${ORIGLANG1} or ${ORIGLANG12} translation. To create one, select a file, then click the <b>Create</b> button.

The drop-down list has extra information in brackets, in the format <b>(TEXTDOMAIN package)</b>. In particular, package=WOOF means the file is in Woof, or the name of the package from which the file comes is given, or if not known then package=UNKNOWN.

A <b>pot</b> file is a translation template file. MoManager converts it to a <b>po</b> file, which is an editable form for your language, and it is finally compiled to a <b>mo</b> file and placed at /usr/share/locale.

There are many other binary executable applications in Puppy that are not managed by MoManager. For those, for example the Abiword word processor, the author of the application provides translations. In many cases you can find a nls translation package for an application via the Puppy Package Manager."
export DLG_HELP_NOBIN="<window resizable=\"false\" title=\"MoManager: Help create mo files\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${NOBIN_HELP_MSG}\"</label><variable>VAR_HELP_NOBIN</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_NOBIN</action></button></hbox></vbox></window>"
NOBINHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_NOBIN</action></button>'

######langpack PET#####
#help button for PET langpack...
GENLANG="$ORIGLANG1"
[ "$TRANSLANG" ] && GENLANG="$TRANSLANG"
PET_HELP_MSG="When you create or edit a translation file in MoManager, it gets put into a tarball, ready for you to email to the author of the application. However, if someone, such as yourself, would like to be maintainer of <b>${ORIGLANG12}</b> translations for Puppy, this would be a great help -- having one guy that we know looks after translations for that language.

As maintainer of ${ORIGLANG12} translations, if you click the <b>PET button</b> in the main window of MoManager, a <b>langpack</b> PET package will be created with all of the translations. Then, all that you have to do is send it to me (Barry Kauler) so that I can upload it to the official noarch PET repository at ibiblio.org.

This will be extremely easy to update. Whenever you have added new translations, or edited existing ones, just click the PET button, and a new langpack PET package will be created. It will have a name like <b>langpack_${GENLANG}-${ADATE}.pet</b>, and be in the /root folder (as well as an expanded directory so that you can see what is in it). Then just send it to me, at <b>bkauler@gmail.com</b>."
export DLG_HELP_PET="<window resizable=\"false\" title=\"MoManager: Help langpack PET\" icon-name=\"${HELPICON}\" window_position=\"1\"><vbox><text use-markup=\"true\"><label>\"${PET_HELP_MSG}\"</label><variable>VAR_HELP_PET</variable></text><hbox><button><label>Close</label><action type=\"closewindow\">VAR_HELP_PET</action></button></hbox></vbox></window>"
PETHELP_XML='<button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action type="launch">DLG_HELP_PET</action></button>'




POEDIT_XML=""; POEDIT_CHECK='false'
if [ "$POEDITOR" ];then
 [ -e /var/local/poedit_check ] && POEDIT_CHECK='true'
 POEDIT_XML="<checkbox><label>Tick to use poedit (instead of text editor)</label><default>${POEDIT_CHECK}</default><variable>POCHECK</variable></checkbox> <text><label>\"    \"</label></text>"
fi

export MM2_DLG="<window title=\"MoManager: Puppy files\" window_position=\"1\" resizable=\"false\" icon-name=\"${WINICON}\">
 <vbox>
 
  <text use-markup=\"true\" width-chars=\"86\"><label>\"<big>Welcome! To fully translate Puppy to your <b>${ORIGLANG12}</b> locale, you need to get all of the files on the right-side drop-down lists over to the left-side lists. Simple! Click the help buttons for explanation about each list...</big>\"</label></text>

  <frame Scripts>
  <hbox>
   <vbox>
    <frame Scripts that have a mo file>
     <hbox>${YESMO_XML}<button><label>Edit</label><action>EXIT:edit_mo</action></button>${YESMOHELP_XML}</hbox>
    </frame>
   </vbox>
   <vbox>
    <frame Scripts that do not have a mo file>
     <hbox>${NOMO_XML}<button><label>Create</label><action>EXIT:create_mo</action></button>${NOMOHELP_XML}</hbox>
    </frame>
   </vbox>
  </hbox>
  </frame>
  
  <frame Menu categories>
   <hbox>
    <vbox>
     <frame Menu categories with a ${ORIGLANG1} translation>
      <hbox>${YESTOP_XML}<button><label>Edit</label><action>EXIT:edit_top</action></button>${YESTOPHELP_XML}</hbox>
     </frame>
    </vbox>
    <vbox>
     <frame Menu categories without a ${ORIGLANG1} translation>
     <hbox>${NOTOP_XML}<button><label>Create</label><action>EXIT:create_top</action></button>${NOTOPHELP_XML}</hbox>
     </frame>
    </vbox>
   </hbox>
  </frame>
  
  <frame Menu entries>
   <hbox>
    <vbox>
     <frame Menu entries with a ${ORIGLANG1} translation>
      <hbox>${YESDESK_XML}<button><label>Edit</label><action>EXIT:edit_desk</action></button>${YESDESKHELP_XML}</hbox>
     </frame>
    </vbox>
    <vbox>
     <frame Menu entries without a ${ORIGLANG1} translation>
     <hbox>${NODESK_XML}<button><label>Create</label><action>EXIT:create_desk</action></button>${NODESKHELP_XML}</hbox>
     </frame>
    </vbox>
   </hbox>
  </frame>
  
  <frame XML files>
   <hbox>
    <vbox>
     <frame XML files with a ${ORIGLANG1} translation>
      <hbox>${YESXML_XML}<button><label>Edit</label><action>EXIT:edit_xml</action></button>${YESXMLHELP_XML}</hbox>
     </frame>
    </vbox>
    <vbox>
     <frame XML files without a ${ORIGLANG1} translation>
     <hbox>${NOXML_XML}<button><label>Create</label><action>EXIT:create_xml</action></button>${NOXMLHELP_XML}</hbox>
     </frame>
    </vbox>
   </hbox>
  </frame>
  
  <frame SSS domains>
   <hbox>
    <vbox>
     <frame SSS domains with a ${ORIGLANG1} translation>
      <hbox>${YESSSS_XML}<button><label>Edit</label><action>EXIT:edit_sss</action></button>${YESSSSHELP_XML}</hbox>
     </frame>
    </vbox>
    <vbox>
     <frame SSS domains without a ${ORIGLANG1} translation>
     <hbox>${NOSSS_XML}<button><label>Create</label><action>EXIT:create_sss</action></button>${NOSSSHELP_XML}</hbox>
     </frame>
    </vbox>
   </hbox>
  </frame>

  <frame Binary executables>
   <hbox>
    <vbox>
     <frame Binary executables that have a mo file>
      <hbox>${YESBIN_XML}<button><label>Edit</label><action>EXIT:edit_bin</action></button>${YESBINHELP_XML}</hbox>
     </frame>
    </vbox>
    <vbox>
     <frame Binary executables that do not have a mo file>
     <hbox>${NOBIN_XML}<button><label>Create</label><action>EXIT:create_bin</action></button>${NOBINHELP_XML}</hbox>
     </frame>
    </vbox>
   </hbox>
  </frame>
  
  
  <hbox>
   ${POEDIT_XML}
   <text><label>Create a langpack PET:</label></text>
   <button><input file>/usr/local/lib/X11/mini-icons/pet16.xpm</input><action>EXIT:create_pet</action></button>
   ${PETHELP_XML}
   <text><label>\"                 \"</label></text>
   <button><label>About</label><action>pupdialog --background '#8080FF' --backtitle 'MoManager: About' --msgbox 'Created by Barry Kauler for Puppy Linux. (c) Copyright Barry Kauler 2012, license GPL3 (refer /usr/share/doc/legal)' 0 0 & </action></button>
   <button><label>Exit</label><action>EXIT:quit</action></button>
  </hbox>
  
 </vbox>
</window>
"
#echo "$MM2_DLG" > /tmp/xxx #TEST
kill $yPID

MM1RET="`$GTKDIALOGEXE --program=MM2_DLG`"
eval "$MM1RET"

if [ "$POEDITOR" ];then
 if [ "$POCHECK" = "true" ];then
  touch /var/local/poedit_check
 else
  rm -f /var/local/poedit_check 2>/dev/null
  POEDITOR=""
 fi
fi

#note: edit_mo and create_mo have much common code, *to do* eliminate duplication.
case $EXIT in
 edit_mo)
  #ex: YESMO_COMBO='/usr/sbin/mousecheck (de mousecheck.mo)'
  ASCRIPT="`echo -n "$YESMO_COMBO" | cut -f 1 -d '(' | rev | cut -f 2-9 -d ' ' | rev`"
  ANAME="`basename "$ASCRIPT"`"
  ATRANSLANG="`echo -n "$YESMO_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ' '`" #ex: de
  AMO="`echo -n "$YESMO_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')' | cut -f 2 -d ' '`" #ex: mousecheck.mo
  APKGNAME="`echo -n "$YESMO_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')' | cut -f 3 -d ' '`" #ex: bluefish  ex: WOOF
  AMOSPEC="/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/${AMO}"
  ATEXTDOMAIN="`basename $AMO .mo`"
  cp -f "$AMOSPEC" /tmp/momanager/${ATEXTDOMAIN}.moOLD
  msgunfmt "$AMOSPEC" > /tmp/momanager/${ATEXTDOMAIN}1.po
  cd /tmp/momanager
  case $ATEXTDOMAIN in
   alsaconf)
    #rodin.s: xgettext does not work properly on alsaconf script, use ready-made alsaconf.pot (in Woof).
    cp -f /usr/share/doc/nls/alsaconf/alsaconf.pot ./
   ;;
   *)
    cp -f "$ASCRIPT" ${ANAME}.sh #hack
    rxvt -e xgettext --no-wrap -o ${ATEXTDOMAIN}.pot ${ANAME}.sh
   ;;
  esac
  #this syncs textdomain1.po and textdomain.pot, merges to textdomain.po ...
  rm -f ${ATEXTDOMAIN}.po 2>/dev/null
  rxvt -e intltool-update --dist --gettext-package=${ATEXTDOMAIN} --output-file=${ATEXTDOMAIN}.po ${ATEXTDOMAIN}1
  sync
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The .mo file has been converted to an editable .po file. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg
  chmod 755 /tmp/momanager/yafmsg
  /tmp/momanager/yafmsg & #msg has delay so will appear on top of text editor window.
  if [ "$POEDITOR" ];then
   LANG=${ORIGLANG} ${POEDITOR} /tmp/momanager/${ATEXTDOMAIN}.po
  else
   killall geany 2> /dev/null #otherwise geany will return immediately and continue executing this script.
   sleep 0.5
   LANG=${ORIGLANG} defaulttexteditor /tmp/momanager/${ATEXTDOMAIN}.po
  fi
  rxvt -e msgfmt --check --output-file=/tmp/momanager/${ATEXTDOMAIN}.mo /tmp/momanager/${ATEXTDOMAIN}.po
  pupdialog --background yellow --colors --backtitle "MoManager: post-edit mo" --yes-label "OK" --no-label "Cancel" --yesno "The file /tmp/momanager/${ATEXTDOMAIN}.po has been edited and converted to /tmp/momanager/${ATEXTDOMAIN}.mo. If all went well, click the \ZbOK\ZB button to copy it to \Zb${AMOSPEC}\ZB. Note, as a precaution, the old mo file is at /tmp/momanager/${ATEXTDOMAIN}.moOLD." 0 0
  if [ $? -eq 0 ];then
   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo "${AMOSPEC}"
   #output as a tarball that user can email to pkg author...
   mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/locale/${ATRANSLANG}/LC_MESSAGES
   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/
   ASTAT="`stat --format=%y "$ASCRIPT" | cut -f 1 -d ' ' | tr -d '-' `" #so can check against file version in latest Woof.
   [ -f ${PATHPREFIX}${ASCRIPT} ] && ASTAT="`stat --format=%y "${PATHPREFIX}$ASCRIPT" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
   echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_SCRIPT=${ASTAT} SCRIPT='${ASCRIPT}' MO_FILE='${AMOSPEC}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
   cd /root
   mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
   dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
   TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
   case $APKGNAME in
    WOOF)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} is part of Woof, so if the translation file works, please email it to Barry Kauler so that it may be included in Woof for all future Puppy builds.
${TARBALLMSG}
You are welcome to email the tarball to Barry at: \Zbbkauler@gmail.com\ZB -- thanks, that will be very helpful for internationalization of Puppy!"
    ;;
    UNKNOWN)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} does not seem to be part of Woof, nor can it be determined if it is part of a package. if you know who the author of the script is, you might wish to send the translation file to that person.
${TARBALLMSG}
You can email the tarball to someone."
    ;;
    *)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} appears to be part of package ${APKGNAME}, and you may wish to send the translation file to the author of that package.
${TARBALLMSG}
You can email the tarball to the author of the package."
    ;;
   esac
   pupdialog --background green --colors --backtitle "MoManager: mo edit completed" --msgbox "${DONEMSG}" 0 0
  else
   pupdialog --background pink --backtitle "MoManager: mo edit aborted" --msgbox "You have declined to update the mo file. Ok, the previous one has been retained." 0 0
  fi
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 create_mo)
  #ex: NOMO_COMBO='/usr/sbin/mousecheck (mousecheck)'
  ASCRIPT="`echo -n "$NOMO_COMBO" | cut -f 1 -d '(' | rev | cut -f 2 -d ' ' | rev`"
  ATEXTDOMAIN="`echo -n "$NOMO_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ' '`"
  APKGNAME="`echo -n "$NOMO_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')' | cut -f 2 -d ' '`" #ex: bluefish  ex: WOOFBUILTIN
  FIELD2ND="`echo -n "$ORIGLANG12" | cut -f 2 -d '_'`"
  pupdialog --colors --background yellow --backtitle "MoManager: mo language" --yes-label "${ORIGLANG1}" --no-label "${ORIGLANG12}" --yesno "Please click the \Zb${ORIGLANG1}\ZB button to create a translation file for that language. However, the \Zb${FIELD2ND}\ZB designates a particular country in which the language is used, and if you need such a specific translation then click the \Zb${ORIGLANG12}\ZB button. It is highly recommended that you click the \Zb${ORIGLANG1}\ZB button, unless you absolutely must have a country-specific translation..." 0 0
  if [ $? -eq 0 ];then
   ATRANSLANG="$ORIGLANG1"
  else
   ATRANSLANG="$ORIGLANG12"
  fi
#  ATEXTDOMAIN="`basename "$NOMO_COMBO"`"
#  if [ "`which $ATEXTDOMAIN`" = "" ];then #if not in path, then insert a prefix...
#   adirspec="`dirname "$NOMO_COMBO"`"
#   aprefix="`basename "$adirspec" | sed -e 's%[^a-zA-Z0-9]%%g'`"
#   ATEXTDOMAIN="${aprefix}___${ATEXTDOMAIN}"
#  fi
  ANAME="`basename "$ASCRIPT"`"
  AMO="${ATEXTDOMAIN}.mo"
  AMOSPEC="/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/${AMO}"
  mkdir -p /usr/share/locale/${ATRANSLANG}/LC_MESSAGES
  cp -f "$ASCRIPT" /tmp/momanager/${ANAME}.sh #i think the .sh helps xgettext.
  cd /tmp/momanager
  case $ATEXTDOMAIN in
   alsaconf)
    #rodin.s: xgettext does not work properly on alsaconf script, use ready-made alsaconf.pot (in Woof).
    cp -f /usr/share/doc/nls/alsaconf/alsaconf.pot ./
   ;;
   *)
    rxvt -e xgettext -o ${ATEXTDOMAIN}.pot --no-wrap ${ANAME}.sh
    aPTN="s%Project-Id-Version: PACKAGE VERSION%Project-Id-Version: ${ANAME} VERSION%"
    bPTN="s%Content-Type: text/plain; charset=CHARSET%Content-Type: text/plain; charset=UTF-8%"
    cPTN="s% PACKAGE package% ${ANAME} package%"
    #dPTN="s%Content-Type: text/plain; charset=ASCII%Content-Type: text/plain; charset=UTF-8%"
    sed -i -e "$aPTN" -e "$bPTN" -e "$cPTN" ${ATEXTDOMAIN}.pot
   ;;
  esac
  rxvt -e msginit --no-wrap --locale=${ORIGLANG12} --output-file=${ATEXTDOMAIN}.po --input=${ATEXTDOMAIN}.pot
  sync
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The translation file is now open in a text editor. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg2
  chmod 755 /tmp/momanager/yafmsg2
  /tmp/momanager/yafmsg2 & #msg has delay so will appear on top of text editor window.
  if [ "$POEDITOR" ];then
   LANG=${ORIGLANG} ${POEDITOR} /tmp/momanager/${ATEXTDOMAIN}.po
  else
   killall geany 2> /dev/null #otherwise geany will return immediately and continue executing this script.
   sleep 0.5
   LANG=${ORIGLANG} defaulttexteditor /tmp/momanager/${ATEXTDOMAIN}.po
  fi
  rxvt -e msgfmt --check --output-file=/tmp/momanager/${ATEXTDOMAIN}.mo /tmp/momanager/${ATEXTDOMAIN}.po
  pupdialog --background yellow --colors --backtitle "MoManager: post-edit mo" --yes-label "OK" --no-label "Cancel" --yesno "The file /tmp/momanager/${ATEXTDOMAIN}.po has been edited and converted to /tmp/momanager/${ATEXTDOMAIN}.mo (the former being the editable translation file and the latter being the compiled translation file). If all went well, click the \ZbOK\ZB button to copy it to \Zb${AMOSPEC}\ZB." 0 0
  if [ $? -eq 0 ];then
   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo "${AMOSPEC}"
   #output as a tarball that user can email to pkg author...
   mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/locale/${ATRANSLANG}/LC_MESSAGES
   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/
   ASTAT="`stat --format=%y "$ASCRIPT" | cut -f 1 -d ' ' | tr -d '-' `" #so can check against file version in latest Woof.
   [ -f ${PATHPREFIX}${ASCRIPT} ] && ASTAT="`stat --format=%y "${PATHPREFIX}$ASCRIPT" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
   echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_SCRIPT=${ASTAT} SCRIPT='${ASCRIPT}' MO_FILE='${AMOSPEC}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
   cd /root
   mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
   dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
   TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
   case $APKGNAME in
    WOOF)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} is part of Woof, so if the translation file works, please email it to Barry Kauler so that it may be included in Woof for all future Puppy builds.
${TARBALLMSG}
You are welcome to email the tarball to Barry at: \Zbbkauler@gmail.com\ZB -- thanks, that will be very helpful for internationalization of Puppy!"
    ;;
    UNKNOWN)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} does not seem to be part of Woof, nor can it be determined if it is part of a package. if you know who the author of the script is, you might wish to send the translation file to that person.
${TARBALLMSG}
You can email the tarball to someone."
    ;;
    *)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} appears to be part of package ${APKGNAME}, and you may wish to send the translation file to the author of that package. 
${TARBALLMSG}
You can email the tarball to the author of the package."
    ;;
   esac
   pupdialog --background green --colors --backtitle "MoManager: mo edit completed" --msgbox "${DONEMSG}" 0 0
  else
   pupdialog --background pink --backtitle "MoManager: mo edit aborted" --msgbox "You have declined to use the mo file. Ok, it has been left at /tmp/momanager/${ATEXTDOMAIN}.mo and will not be used." 0 0
  fi
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 edit_desk|create_desk)
  if [ "$EXIT" = "edit_desk" ];then
   DESKFILE="`echo -n "$YESDESK_COMBO" | cut -f 1 -d ' '`"
   APKGNAME="`echo -n "$YESDESK_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')'`"
   cp -f -a /usr/share/applications/$DESKFILE /tmp/momanager/
  else
   DESKFILE="`echo -n "$NODESK_COMBO" | cut -f 1 -d ' '`"
   APKGNAME="`echo -n "$NODESK_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')'`"
   cp -f -a /usr/share/applications/$DESKFILE /tmp/momanager/
   sed -i -e "s%^Name=%Name[${ORIGLANG1}]=PLEASE INSERT YOUR TRANSLATION HERE\\nName=%" /usr/share/applications/$DESKFILE
  fi
  sync
  killall geany 2>/dev/null
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The menu file is now open in a text editor. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg3
  chmod 755 /tmp/momanager/yafmsg3
  /tmp/momanager/yafmsg3 & #msg has delay so will appear on top of text editor window.
  ASTAT="`stat --format=%y "/usr/share/applications/$DESKFILE" | cut -f 1 -d ' ' | tr -d '-' `" #so can check against file version in latest Woof.
  [ -f ${PATHPREFIX}/usr/share/applications/$DESKFILE ] && ASTAT="`stat --format=%y "${PATHPREFIX}/usr/share/applications/$DESKFILE" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
  xASTAT1="`stat --format=%Y "/usr/share/applications/$DESKFILE"`" #seconds since epoch.
  LANG=${ORIGLANG} defaulttexteditor /usr/share/applications/$DESKFILE
  xASTAT2="`stat --format=%Y "/usr/share/applications/$DESKFILE"`" #seconds since epoch.
  if [ "`grep 'PLEASE INSERT YOUR TRANSLATION HERE' /usr/share/applications/$DESKFILE`" != "" ];then
   mv -f /tmp/momanager/$DESKFILE /usr/share/applications/
   xASTAT2="$xASTAT1"
  fi
  if [ "$xASTAT1" = "$xASTAT2" ];then
   export LANG=$ORIGLANG
   exec momanager reenter
  fi
  yaf-splash -bg '#80FF80' -timeout 3 -text "The menu is being updated..." &
  LANG=$ORIGLANG /usr/sbin/fixmenus
  if [ "`pidof jwm`" != "" ];then
   JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
   if vercmp $JWMVER lt 574;then
    LANG=${ORIGLANG} jwm -restart
   else
    LANG=${ORIGLANG} jwm -reload
   fi
  fi
  cp -f /usr/share/applications/$DESKFILE /root/
  #add translation to tarball that user can email to pkg author...
  cd /root
  mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/applications
  cp -f /usr/share/applications/$DESKFILE /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/applications/
  echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_FILE=${ASTAT} DESKTOP_FILE='/usr/share/applications/${DESKFILE}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
  cd /root
  mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
  dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
  TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
  case $APKGNAME in
   WOOF)
    DONEMSG="As this menu file is from Woof, please email the tarball to Barry Kauler \Zbbkauler@gmail.com\ZB, so that all future builds of Puppy may benefit from your translation!"
   ;;
   UNKNOWN)
    DONEMSG="It is not known which package this menu file is from. However, if you can find out, please email the tarball to the maintainer of that package."
   ;;
   *)
    DONEMSG="The menu file is part of package ${APKGNAME}. If you can find out the email address of the maintainer of that package, please email the tarball, it will be appreciated!"
   ;;
  esac
  pupdialog --background green --colors --backtitle "MoManager: Menu edit completed" --msgbox "You have edited \Zb${DESKFILE}\ZB and the menu has been refreshed.
${TARBALLMSG}
${DONEMSG}" 0 0
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 edit_top|create_top) #menu categories.
  APKGNAME='WOOF'
  if [ "$EXIT" = "edit_top" ];then
   TOPFILE="$YESTOP_COMBO"
   cp -f -a /usr/share/desktop-directories/$TOPFILE /tmp/momanager/
  else
   TOPFILE="$NOTOP_COMBO"
   cp -f -a /usr/share/desktop-directories/$TOPFILE /tmp/momanager/
   sed -i -e "s%^Name=%Name[${ORIGLANG1}]=PLEASE INSERT YOUR TRANSLATION HERE\\nName=%" /usr/share/desktop-directories/$TOPFILE
  fi
  sync
  killall geany 2>/dev/null
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The menu-category file is now open in a text editor. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg4
  chmod 755 /tmp/momanager/yafmsg4
  /tmp/momanager/yafmsg4 & #msg has delay so will appear on top of text editor window.
  ASTAT="`stat --format=%y "/usr/share/desktop-directories/$TOPFILE" | cut -f 1 -d ' ' | tr -d '-' `" #so can check against file version in latest Woof.
  [ -f ${PATHPREFIX}/usr/share/desktop-directories/$TOPFILE ] && ASTAT="`stat --format=%y "${PATHPREFIX}/usr/share/desktop-directories/$TOPFILE" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
  xASTAT1="`stat --format=%Y "/usr/share/desktop-directories/$TOPFILE"`" #seconds since epoch.
  LANG=${ORIGLANG} defaulttexteditor /usr/share/desktop-directories/$TOPFILE
  xASTAT2="`stat --format=%Y "/usr/share/desktop-directories/$TOPFILE"`" #seconds since epoch.

  if [ "`grep 'PLEASE INSERT YOUR TRANSLATION HERE' /usr/share/desktop-directories/$TOPFILE`" != "" ];then
   mv -f /tmp/momanager/$TOPFILE /usr/share/desktop-directories/
   xASTAT2="$xASTAT1"
  fi
  if [ "$xASTAT1" = "$xASTAT2" ];then
   export LANG=$ORIGLANG
   exec momanager reenter
  fi
  yaf-splash -bg '#80FF80' -timeout 3 -text "The menu is being updated..." &
  LANG=$ORIGLANG /usr/sbin/fixmenus
  if [ "`pidof jwm`" != "" ];then
   JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
   if vercmp $JWMVER lt 574;then
    LANG=${ORIGLANG} jwm -restart
   else
    LANG=${ORIGLANG} jwm -reload
   fi
  fi
  cp -f /usr/share/desktop-directories/$TOPFILE /root/
  #add translation to tarball that user can email to pkg author...
  cd /root
  mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/applications
  cp -f /usr/share/desktop-directories/$TOPFILE /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/applications/
  echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_FILE=${ASTAT} CATEGORY_FILE='/usr/share/desktop-directories/${TOPFILE}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
  cd /root
  mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
  dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
  TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
  case $APKGNAME in
   WOOF)
    DONEMSG="As this menu file is from Woof, please email the tarball to Barry Kauler \Zbbkauler@gmail.com\ZB, so that all future builds of Puppy may benefit from your translation!"
   ;;
   UNKNOWN)
    DONEMSG="It is not known which package this menu file is from. However, if you can find out, please email the tarball to the maintainer of that package."
   ;;
   *)
    DONEMSG="The menu file is part of package ${APKGNAME}. If you can find out the email address of the maintainer of that package, please email the tarball, it will be appreciated!"
   ;;
  esac
  pupdialog --background green --colors --backtitle "MoManager: Menu edit completed" --msgbox "You have edited \Zb${TOPFILE}\ZB and the menu has been refreshed.
${TARBALLMSG}
${DONEMSG}" 0 0
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 create_sss) #BK's Simple String Substitution method.
  APKGNAME="WOOF"
  SSSFILE="$NOSSS_COMBO" #ex: menu_strings (located at /usr/share/sss/menu_strings/)
  cp -f /usr/share/sss/$SSSFILE/$SSSFILE /tmp/momanager/$SSSFILE.$ORIGLANG1
  sync
  killall geany 2>/dev/null
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The SSS file is now open in a text editor. You must only edit between the last two % characters. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg5
  chmod 755 /tmp/momanager/yafmsg5
  /tmp/momanager/yafmsg5 & #msg has delay so will appear on top of text editor window.
  ASTAT="`stat --format=%y "/usr/share/sss/$SSSFILE/$SSSFILE" | cut -f 1 -d ' ' | tr -d '-'`" #so can check against file version in latest Woof.
  [ -f ${PATHPREFIX}/usr/share/sss/$SSSFILE/$SSSFILE ] && ASTAT="`stat --format=%y "${PATHPREFIX}/usr/share/sss/$SSSFILE/$SSSFILE" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
  xASTAT1="`stat --format=%Y "/tmp/momanager/$SSSFILE.$ORIGLANG1"`" #seconds since epoch.
  LANG=${ORIGLANG} defaulttexteditor /tmp/momanager/$SSSFILE.$ORIGLANG1
  xASTAT2="`stat --format=%Y "/tmp/momanager/$SSSFILE.$ORIGLANG1"`" #seconds since epoch.
  if [ "$xASTAT1" = "$xASTAT2" ];then
   export LANG=$ORIGLANG
   exec momanager reenter
  fi
  [ "$SSSFILE" = "desk_strings" ] && fixdesk en #120212 translate all target files back to english. (using old $SSSFILE)
  [ "$SSSFILE" = "script_strings" ] && fixscripts en #120212 translate all target files back to english. (using old $SSSFILE)
  cp -f /tmp/momanager/$SSSFILE.$ORIGLANG1 /usr/share/sss/$SSSFILE/
  [ "$SSSFILE" = "desk_strings" ] && fixdesk $ORIGLANG1 #120212 translate all target files back to current language. (using new SSSFILE)
  [ "$SSSFILE" = "script_strings" ] && fixscripts $ORIGLANG1 #120212 translate all target files back to current language. (using new SSSFILE)
  yaf-splash -bg '#80FF80' -timeout 3 -text "The desktop and menus are being updated..." &
  LANG=$ORIGLANG /usr/sbin/fixmenus
  if [ "`pidof jwm`" != "" ];then
   JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
   if vercmp $JWMVER lt 574;then
    LANG=${ORIGLANG} jwm -restart
   else
    LANG=${ORIGLANG} jwm -reload
   fi
  fi
  echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_FILE=${ASTAT} SSS_FILE='/usr/share/sss/${SSSFILE}/${SSSFILE}.${ORIGLANG1}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
  mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/sss/${SSSFILE}/
  cp -f /tmp/momanager/$SSSFILE.$ORIGLANG1 /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/sss/${SSSFILE}/
  cd /root
  mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
  dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
  TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
  DONEMSG="As this SSS file is from Woof, please email the tarball to Barry Kauler \Zbbkauler@gmail.com\ZB, so that all future builds of Puppy may benefit from your translation!"
  TESTINGMSG=""
  case $SSSFILE in
   desk_strings)
    TESTINGMSG="
Development note: It is recommended that you test your translation, by testing that the target file(s) translate between en and ${ORIGLANG1}. You can do this in a terminal by typing \Zbfixdesk en\ZB to translate to en, and \Zbfixdesk ${ORIGLANG1}\ZB to translate to ${ORIGLANG1} -- try it backwards and forwards a few times to check translation works properly."
   ;;
   script_strings)
    TESTINGMSG="
Development note: It is recommended that you test your translation, by testing that the target file(s) translate between en and ${ORIGLANG1}. You can do this in a terminal by typing \Zbfixscripts en\ZB to translate to en, and \Zbfixscripts ${ORIGLANG1}\ZB to translate to ${ORIGLANG1} -- try it backwards and forwards a few times to check translation works properly."
   ;;
   initrd_strings)
    TESTINGMSG="
Development note: The initrd_strings SSS domain is for translating files in the initrd, and this occurs at bootup. For example, look in the 'init' script in the initrd.gz to see how it utilizes the translation file. If you want to test your translation for the init script, take out the sed expressions from initrd_strings.${ORIGLANG1} as a file say 'translations', and execute 'sed -f translations init'."
   ;;
  esac
  pupdialog --background green --colors --backtitle "MoManager: SSS edit completed" --msgbox "You have edited \Zb${SSSFILE}.${ORIGLANG1}\ZB and the desktop and menu have been refreshed, however some changes might require a restart of X to be seen.
${TARBALLMSG}
${DONEMSG}
${TESTINGMSG}" 0 0
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 edit_sss)
  APKGNAME="WOOF"
  SSSFILE="$YESSSS_COMBO" #ex: menu_strings.de (located at /usr/share/sss/menu_strings/)
  SSSFILE="`echo -n "$SSSFILE" | rev | cut -f 2-9 -d '.' | rev`" #dump the extension, ex: menu_strings.de -> menu_strings
  #cp -f /usr/share/sss/$SSSFILE/$SSSFILE.$ORIGLANG1 /tmp/momanager/$SSSFILE.$ORIGLANG1
  
  #sync translated sss-file with original (master) sss-file (/usr/share/sss/$SSSFILE/$SSSFILE)...
  #ex: 'menu_strings' is the master (no translations in it), 'menu_strings.de' has German translations.
  #(Woof developers only have to edit the master, and the translation sss-files will sync to it).
  #to do this properly have to write code that analyses the sss-files by section, that is, the files
  #have sections, separated by blank lines and headed by an identifier, ex "[_woof_.jwmrc]"
  #note: /usr/sbin/fixmenus has example sed to extract an sss section.
  echo -n "" > /tmp/momanager/$SSSFILE.$ORIGLANG1
  for ASECTIONID in `grep '^\[' /usr/share/sss/${SSSFILE}/${SSSFILE} | tr -d '[' | tr -d ']' | tr '\n' ' '` #ex: general _woof_.jwmrc
  do
   sPTN="/^\[${ASECTIONID}\]/,/^$/p" #this is a multi-line block find expression.
   ENCODEBLOCK="`sed -n "$sPTN" /usr/share/sss/${SSSFILE}/${SSSFILE} | sed -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
   case $ASECTIONID in
    general)
     #this section is just comments, pass it straight thru...
     echo '[general]' >> /tmp/momanager/$SSSFILE.$ORIGLANG1
     echo "$ENCODEBLOCK" >> /tmp/momanager/$SSSFILE.$ORIGLANG1
     echo  >> /tmp/momanager/$SSSFILE.$ORIGLANG1
    ;;
    *)
     echo "[${ASECTIONID}]" >> /tmp/momanager/$SSSFILE.$ORIGLANG1
     #find same section in the translated sss-file...
     TRCODEBLOCK="`sed -n "$sPTN" /usr/share/sss/${SSSFILE}/${SSSFILE}.${ORIGLANG1} | sed -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
     echo "$TRCODEBLOCK" |
     while read ATRLINE
     do
      case $ATRLINE in
       CODESTRING*)
        eval "$ATRLINE"
        OKLINE="`echo "$ENCODEBLOCK" | grep "$CODESTRING" | grep "$ENGLISH"`"
        [ "$OKLINE" ] && echo "$ATRLINE" >> /tmp/momanager/$SSSFILE.$ORIGLANG1 #match, so keep it.
       ;;
       *)
        echo "$ATRLINE" >> /tmp/momanager/$SSSFILE.$ORIGLANG1 #probably a comment line.
       ;;
      esac
     done
     #now do it the other way around...
     echo "$ENCODEBLOCK" |
     while read AENLINE
     do
      case $AENLINE in
       CODESTRING*)
        eval "$AENLINE"
        OKLINE="`echo "$TRCODEBLOCK" | grep "$CODESTRING" | grep "$ENGLISH"`"
        [ ! "$OKLINE" ] && echo "$AENLINE" >> /tmp/momanager/$SSSFILE.$ORIGLANG1 #new line not in translated sss-file, so write it (not yet translated).
       ;;
      esac
     done
     echo  >> /tmp/momanager/$SSSFILE.$ORIGLANG1
    ;;
   esac
  done
  echo  >> /tmp/momanager/$SSSFILE.$ORIGLANG1
  
  sync
  killall geany 2>/dev/null
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The SSS file is now open in a text editor. You must only edit between the last two % characters. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg5
  chmod 755 /tmp/momanager/yafmsg5
  /tmp/momanager/yafmsg5 & #msg has delay so will appear on top of text editor window.
  ASTAT="`stat --format=%y "/usr/share/sss/$SSSFILE/$SSSFILE.$ORIGLANG1" | cut -f 1 -d ' ' | tr -d '-'`" #so can check against file version in latest Woof.
  [ -f ${PATHPREFIX}/usr/share/sss/$SSSFILE/$SSSFILE.$ORIGLANG1 ] && ASTAT="`stat --format=%y "${PATHPREFIX}/usr/share/sss/$SSSFILE/$SSSFILE.$ORIGLANG1" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
  xASTAT1="`stat --format=%Y "/tmp/momanager/$SSSFILE.$ORIGLANG1"`" #seconds since epoch.
  LANG=${ORIGLANG} defaulttexteditor /tmp/momanager/$SSSFILE.$ORIGLANG1
  xASTAT2="`stat --format=%Y "/tmp/momanager/$SSSFILE.$ORIGLANG1"`" #seconds since epoch.
  if [ "$xASTAT1" = "$xASTAT2" ];then
   export LANG=$ORIGLANG
   exec momanager reenter
  fi
  [ "$SSSFILE" = "desk_strings" ] && fixdesk en #120209 translate all target files back to english. (using old $SSSFILE)
  [ "$SSSFILE" = "script_strings" ] && fixscripts en #120209 translate all target files back to english. (using old $SSSFILE)
  cp -f /tmp/momanager/$SSSFILE.$ORIGLANG1 /usr/share/sss/$SSSFILE/
  [ "$SSSFILE" = "desk_strings" ] && fixdesk $ORIGLANG1 #120209 translate all target files back to current language. (using new SSSFILE)
  [ "$SSSFILE" = "script_strings" ] && fixscripts $ORIGLANG1 #120209 translate all target files back to current language. (using new SSSFILE)
  yaf-splash -bg '#80FF80' -timeout 3 -text "The desktop and menus are being updated..." &
  LANG=$ORIGLANG /usr/sbin/fixmenus
  if [ "`pidof jwm`" != "" ];then
   JWMVER=`jwm -v|head -n1|cut -d ' ' -f2|cut -d - -f2`
   if vercmp $JWMVER lt 574;then
    LANG=${ORIGLANG} jwm -restart
   else
    LANG=${ORIGLANG} jwm -reload
   fi
  fi
  echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_FILE=${ASTAT} SSS_FILE='/usr/share/sss/${SSSFILE}/${SSSFILE}.${ORIGLANG1}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
  mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/sss/${SSSFILE}/
  cp -f /tmp/momanager/$SSSFILE.$ORIGLANG1 /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/sss/${SSSFILE}/
  cd /root
  mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
  dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
  TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
  DONEMSG="As this SSS file is from Woof, please email the tarball to Barry Kauler \Zbbkauler@gmail.com\ZB, so that all future builds of Puppy may benefit from your translation!"
  TESTINGMSG=""
  case $SSSFILE in
   desk_strings)
    TESTINGMSG="
Development note: It is recommended that you test your translation, by testing that the target file(s) translate between en and ${ORIGLANG1}. You can do this in a terminal by typing \Zbfixdesk en\ZB to translate to en, and \Zbfixdesk ${ORIGLANG1}\ZB to translate to ${ORIGLANG1} -- try it backwards and forwards a few times to check translation works properly."
   ;;
   script_strings)
    TESTINGMSG="
Development note: It is recommended that you test your translation, by testing that the target file(s) translate between en and ${ORIGLANG1}. You can do this in a terminal by typing \Zbfixscripts en\ZB to translate to en, and \Zbfixscripts ${ORIGLANG1}\ZB to translate to ${ORIGLANG1} -- try it backwards and forwards a few times to check translation works properly."
   ;;
   initrd_strings)
    TESTINGMSG="
Development note: The initrd_strings SSS domain is for translating files in the initrd, and this occurs at bootup. For example, look in the 'init' script in the initrd.gz to see how it utilizes the translation file. If you want to test your translation for the init script, take out the sed expressions from initrd_strings.${ORIGLANG1} as a file say 'translations', and execute 'sed -f translations init'."
   ;;
  esac
  pupdialog --background green --colors --backtitle "MoManager: SSS edit completed" --msgbox "You have edited \Zb${SSSFILE}.${ORIGLANG1}\ZB and the desktop and menu have been refreshed, however some changes might require restart of X to be seen.
${TARBALLMSG}
${DONEMSG}
${TESTINGMSG}" 0 0
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 edit_xml|create_xml) #XML data files.
  if [ "$EXIT" "edit_xml" ];then
   XMLFILE="`echo -n "$YESXML_COMBO" | cut -f 1 -d ' '`"
   APKGNAME="`echo -n "$YESXML_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')'`"
  else
   XMLFILE="`echo -n "$NOXML_COMBO" | cut -f 1 -d ' '`"
   APKGNAME="`echo -n "$NOXML_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')'`"
  fi
  sync
  killall geany 2>/dev/null
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The XML file is now open in a text editor. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg7
  chmod 755 /tmp/momanager/yafmsg7
  /tmp/momanager/yafmsg7 & #msg has delay so will appear on top of text editor window.
  ASTAT="`stat --format=%y "$XMLFILE" | cut -f 1 -d ' ' | tr -d '-' `" #so can check against file version in latest Woof.
  [ -f "${PATHPREFIX}${XMLFILE}" ] && ASTAT="`stat --format=%y "${PATHPREFIX}${XMLFILE}" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
  xASTAT1="`stat --format=%Y "${XMLFILE}"`" #seconds since epoch.
  LANG=${ORIGLANG} defaulttexteditor "${XMLFILE}"
  xASTAT2="`stat --format=%Y "${XMLFILE}"`" #seconds since epoch.
  if [ "$xASTAT1" = "$xASTAT2" ];then
   export LANG=$ORIGLANG
   exec momanager reenter
  fi
  #add translation to tarball that user can email to pkg author...
  cd /root
  PATHXMLFILE="`dirname "$XMLFILE"`"
  BASEXMLFILE="`basename "$XMLFILE"`"
  mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}"${PATHXMLFILE}"
  cp -f "$XMLFILE" /root/MoManager-${ORIGLANG12}-${APKGNAME}"${PATHXMLFILE}"/
  echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_FILE=${ASTAT} CATEGORY_FILE='${XMLFILE}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
  cd /root
  mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
  dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
  TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
  case $APKGNAME in
   WOOF)
    DONEMSG="As this XML file is from Woof, please email the tarball to Barry Kauler \Zbbkauler@gmail.com\ZB, so that all future builds of Puppy may benefit from your translation!"
   ;;
   UNKNOWN)
    DONEMSG="It is not known which package this XML file is from. However, if you can find out, please email the tarball to the maintainer of that package."
   ;;
   *)
    DONEMSG="The XML file is part of package ${APKGNAME}. If you can find out the email address of the maintainer of that package, please email the tarball, it will be appreciated!"
   ;;
  esac
  pupdialog --background green --colors --backtitle "MoManager: XML edit completed" --msgbox "You have edited \Zb${XMLFILE}\ZB. Any on-screen display strings might only display after X is restarted.
${TARBALLMSG}
${DONEMSG}" 0 0
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 edit_bin|create_bin) #binary executables.
  if [ "$EXIT" = "edit_bin" ];then
   ABIN="`echo -n "$YESBIN_COMBO" | cut -f 1 -d '(' | rev | cut -f 2-9 -d ' ' | rev`"
   ANAME="`basename "$ABIN"`"
   ATRANSLANG="`echo -n "$YESBIN_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ' '`" #ex: de
   AMO="`echo -n "$YESBIN_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')' | cut -f 2 -d ' '`" #ex: mousecheck.mo
   APKGNAME="`echo -n "$YESBIN_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')' | cut -f 3 -d ' '`" #ex: bluefish  ex: WOOF
   ATEXTDOMAIN="`basename $AMO .mo`"
  else
   ABIN="`echo -n "$NOBIN_COMBO" | cut -f 1 -d '(' | rev | cut -f 2 -d ' ' | rev`"
   ATEXTDOMAIN="`echo -n "$NOBIN_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ' '`"
   APKGNAME="`echo -n "$NOBIN_COMBO" | cut -f 2 -d '(' | cut -f 1 -d ')' | cut -f 2 -d ' '`" #ex: bluefish  ex: WOOF
   FIELD2ND="`echo -n "$ORIGLANG12" | cut -f 2 -d '_'`"
   pupdialog --colors --background yellow --backtitle "MoManager: mo language" --yes-label "${ORIGLANG1}" --no-label "${ORIGLANG12}" --yesno "Please click the \Zb${ORIGLANG1}\ZB button to create a translation file for that language. However, the \Zb${FIELD2ND}\ZB designates a particular country in which the language is used, and if you need such a specific translation then click the \Zb${ORIGLANG12}\ZB button. It is highly recommended that you click the \Zb${ORIGLANG1}\ZB button, unless you absolutely must have a country-specific translation..." 0 0
   if [ $? -eq 0 ];then
    ATRANSLANG="$ORIGLANG1"
   else
    ATRANSLANG="$ORIGLANG12"
   fi
   ANAME="`basename "$ABIN"`"
   AMO="${ATEXTDOMAIN}.mo"
  fi
  AMOSPEC="/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/${AMO}"
  
  cp -f /usr/share/doc/nls/${ATEXTDOMAIN}/${ATEXTDOMAIN}.pot /tmp/momanager/
  cd /tmp/momanager
  
  if [ "$EXIT" = "edit_bin" ];then
   cp -f "$AMOSPEC" /tmp/momanager/${ATEXTDOMAIN}.moOLD
   msgunfmt "$AMOSPEC" > /tmp/momanager/${ATEXTDOMAIN}1.po
   #this syncs textdomain1.po and textdomain.pot, merges to textdomain.po ...
   rm -f ${ATEXTDOMAIN}.po 2>/dev/null
   rxvt -e intltool-update --dist --gettext-package=${ATEXTDOMAIN} --output-file=${ATEXTDOMAIN}.po ${ATEXTDOMAIN}1
  else
   rxvt -e msginit --no-wrap --locale=${ORIGLANG12} --output-file=${ATEXTDOMAIN}.po --input=${ATEXTDOMAIN}.pot
  fi
  
  sync
  echo '#!/bin/sh
  sleep 3
  yaf-splash -bg yellow -placement top -timeout 9 -text "The .mo file has been converted to an editable .po file. Edit, then Save, then Quit text editor..."
  ' > /tmp/momanager/yafmsg9
  chmod 755 /tmp/momanager/yafmsg9
  /tmp/momanager/yafmsg9 & #msg has delay so will appear on top of text editor window.
  if [ "$POEDITOR" ];then
   ${POEDITOR} /tmp/momanager/${ATEXTDOMAIN}.po
  else
   killall geany 2> /dev/null #otherwise geany will return immediately and continue executing this script.
   sleep 0.5
   LANG=${ORIGLANG} defaulttexteditor /tmp/momanager/${ATEXTDOMAIN}.po
  fi
  rxvt -e msgfmt --check --output-file=/tmp/momanager/${ATEXTDOMAIN}.mo /tmp/momanager/${ATEXTDOMAIN}.po
  pupdialog --background yellow --colors --backtitle "MoManager: post-edit mo" --yes-label "OK" --no-label "Cancel" --yesno "The file /tmp/momanager/${ATEXTDOMAIN}.po has been edited and converted to /tmp/momanager/${ATEXTDOMAIN}.mo. If all went well, click the \ZbOK\ZB button to copy it to \Zb${AMOSPEC}\ZB. Note, as a precaution, the old mo file is at /tmp/momanager/${ATEXTDOMAIN}.moOLD." 0 0
  if [ $? -eq 0 ];then
   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo "${AMOSPEC}"
   #output as a tarball that user can email to pkg author...
   mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/locale/${ATRANSLANG}/LC_MESSAGES
   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo /root/MoManager-${ORIGLANG12}-${APKGNAME}/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/
   ASTAT="`stat --format=%y "$ABIN" | cut -f 1 -d ' ' | tr -d '-' `" #so can check against file version in latest Woof.
   [ -f ${PATHPREFIX}${ABIN} ] && ASTAT="`stat --format=%y "${PATHPREFIX}$ABIN" | cut -f 1 -d ' ' | tr -d '-' `" #get orig modify date.
   echo "MACTION=${EXIT} TODAY_DATE=${ADATE} ORIG_DATE_BINARY=${ASTAT} BINARY='${ABIN}' MO_FILE='${AMOSPEC}' AUTHOR='${AUTHORSPECS}'" >> /root/MoManager-${ORIGLANG12}-${APKGNAME}/write.log
   cd /root
   mv -f MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz MoManager-${ORIGLANG12}-${APKGNAME}.tar.gzOLD 2>/dev/null
   dir2tgz MoManager-${ORIGLANG12}-${APKGNAME}/
   TARBALLMSG="Translation files that you have created with MoManager have been copied into folder \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}\ZB, and a tarball has been created, \Zb/root/MoManager-${ORIGLANG12}-${APKGNAME}.tar.gz\ZB. Note, it contains \Zbwrite.log\ZB which records the details of each translation file."
   case $APKGNAME in
    WOOF)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} is part of Woof, so if the translation file works, please email it to Barry Kauler so that it may be included in Woof for all future Puppy builds.
${TARBALLMSG}
You are welcome to email the tarball to Barry at: \Zbbkauler@gmail.com\ZB -- thanks, that will be very helpful for internationalization of Puppy!"
    ;;
    UNKNOWN)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} does not seem to be part of Woof, nor can it be determined if it is part of a package. if you know who the author of the script is, you might wish to send the translation file to that person.
${TARBALLMSG}
You can email the tarball to someone."
    ;;
    *)
     DONEMSG="Ok, the new mo file is in place, and if you wish you may run the script to test it. The script ${ANAME} appears to be part of package ${APKGNAME}, and you may wish to send the translation file to the author of that package.
${TARBALLMSG}
You can email the tarball to the author of the package."
    ;;
   esac
   pupdialog --background green --colors --backtitle "MoManager: mo edit completed" --msgbox "${DONEMSG}" 0 0
  else
   pupdialog --background pink --backtitle "MoManager: mo edit aborted" --msgbox "You have declined to update the mo file." 0 0
  fi
  export LANG=$ORIGLANG
  exec momanager reenter
 ;;
 create_pet) #create a langpack PET
  mv -f /root/langpack_${GENLANG}-${ADATE}.pet /root/langpack_${GENLANG}-${ADATE}.petOLD 2>/dev/null
  [ -d /root/langpack_${GENLANG}-${ADATE} ] && rm -rf /root/langpack_${GENLANG}-${ADATE}
  mkdir /root/langpack_${GENLANG}-${ADATE}
  cp -a -f /usr/share/doc/langpack-template/* /root/langpack_${GENLANG}-${ADATE}/
  echo "langpack_${GENLANG}-${ADATE}|langpack_${GENLANG}|${ADATE}||Setup|1104K||langpack_${GENLANG}-${ADATE}.pet||${GENLANG} language-pack for Puppy Linux, for any Puppy built from Woof later than Feb. 16, 2012||||" > /root/langpack_${GENLANG}-${ADATE}/pet.specs
  sed -i -e "s%TARGETLANG%${ORIGLANG1}%" /root/langpack_${GENLANG}-${ADATE}/pinstall.sh
  LANG=$ORIGLANG POSTMSG="`pupdialog --background "#80FFFF" --backtitle "Post-install message" --colors --stdout --inputbox "A post-install message is required for the PET. Please translate the following into your own language:
\ZbLanguage pack installed, but requires restart of X to take full effect\ZB" 0 0`"
  if [ "$POSTMSG" ];then
   sed -i -e "s%POSTINSTALLMSG%${POSTMSG}%" /root/langpack_${GENLANG}-${ADATE}/pinstall.sh
  else
   sed -i -e "s%POSTINSTALLMSG%Language pack installed, but requires restart of X to take full effect%" /root/langpack_${GENLANG}-${ADATE}/pinstall.sh
  fi
  cat /tmp/momanager/translations4langpack |
  while read ALINE
  do
   ADIR="`dirname "$ALINE"`"
   mkdir -p /root/langpack_${GENLANG}-${ADATE}"${ADIR}"
   cp -a -f "$ALINE" /root/langpack_${GENLANG}-${ADATE}"${ADIR}"/
  done
  mv -f /root/langpack_${GENLANG}-${ADATE}/usr/share/applications /root/langpack_${GENLANG}-${ADATE}/usr/share/applications.in
  mv -f /root/langpack_${GENLANG}-${ADATE}/usr/share/desktop-directories /root/langpack_${GENLANG}-${ADATE}/usr/share/desktop-directories.in
  sync
  cd /root
  dir2tgz /root/langpack_${GENLANG}-${ADATE}
  tgz2pet /root/langpack_${GENLANG}-${ADATE}.tar.gz
  sync
  pupdialog --background '#8080FF' --backtitle "Langpack PET created" --msgbox "Langpack /root/langpack_${GENLANG}-${ADATE}.pet has been created." 0 0
 ;;
esac

###END###