Check-in [10c1621580]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:10c1621580adc2c86416180619e9f910071a97ac
Date: 2012-03-08 09:16:02
User: BarryK
Comment:intltool-update broken with ROX-Filer, workaround implemented. ROX-Filer mo path fix

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/usr/sbin/momanager

@@ -25,10 +25,11 @@
 #120220 need 'head -n1' ex: /usr/local/petget/ui_Classic has export TEXTDOMAIN in two places.
 #120224 add 'doc_strings' sss domain, for translating entire files (typically documentation files). 120225 improvements.
 #120225 checkbox window to select what documentation files to edit. modify edit-complete message.
 #120228 sync doc_strings sss file.
 #120307 ROX-Filer now translated via /usr/share/doc/nls/ROX-Filer/ROX-Filer.pot
+#120308 ROX-Filer .mo files are not in standard location. workaround when intltool-update fails.
 
 #***MOMANAGER IS ENGLISH ONLY (NOT GETTEXT'ED)***
 #it is for use by developers/translators with knowledge of english.
 
 PARAM1=""
@@ -106,10 +107,20 @@
 yPID=$!
 
 echo -n "" > /tmp/momanager/translations4langpack #to create the langpack PET.
 TRANSLANG=""
 
+poptop_func() {
+ #passed param is string to display at top of screen.
+ echo "#!/bin/sh
+ sleep 3
+ yaf-splash -bg yellow -placement top -timeout 9 -text \"${1}\"
+ " > /tmp/momanager/yafmsg99
+ chmod 755 /tmp/momanager/yafmsg99
+ /tmp/momanager/yafmsg99 & #msg has delay so will appear on top of text editor window.
+}
+
 #####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' ' '`"
 
@@ -136,11 +147,11 @@
     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.
+ [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | head -n 1 | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg. 120308
  #...return nothing if in Woof
  [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${xAGTS}" ] && aPKGNAME="WOOF" #file is in Woof.
  [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
 
  FNDMO=""
@@ -190,11 +201,11 @@
 
  #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.
+ [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | head -n 1 | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg. 120308
  #...return nothing if in Woof
  [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${ADESKTOP}" ] && aPKGNAME="WOOF" #file is in Woof.
  [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
 
  if [ "`grep "$dPTN" $ADESKTOP`" != "" ];then
@@ -297,11 +308,12 @@
 bPTN="xml:lang=\"${ORIGLANG12}\"" #ex: xml:lang="de_DE"
 for AXMLFILE in $XMLFILES
 do
  AXMLFILE="`echo -n "$AXMLFILE" | sed -e 's%SPACECHAR% %g'`"
 
- [ "`echo -n "$AXMLFILE" | grep 'apps/ROX-Filer/'`" != "" ] && continue #120307 ROX-Filer now translated via /usr/share/doc/nls/ROX-Filer/ROX-Filer.pot
+ #[ "`echo -n "$AXMLFILE" | grep 'apps/ROX-Filer/'`" != "" ] && continue #120307 ROX-Filer now translated via /usr/share/doc/nls/ROX-Filer/ROX-Filer.pot
+ #120308 ...no, we still need to edit this, see User Manual.
 
  #want to know if from Woof or a builtin pkg or later-installed pkg...
  BASEAXMLFILE="`basename "$AXMLFILE"`"
  xPTN=" ${BASEAXMLFILE}$"
  PATHAXMLFILE="`dirname "$AXMLFILE"`"
@@ -317,11 +329,11 @@
     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.
+ [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | head -n 1 | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg. 120308
  #...return nothing if in Woof
  [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${AXMLFILE}" ] && aPKGNAME="WOOF" #file is in Woof.
  [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
 
  FNDFLAG=''
@@ -467,30 +479,37 @@
        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.
+    [ ! "$aPKGNAME" ] && aPKGNAME="`grep "$zPTN" /root/.packages/*.files 2>/dev/null | head -n 1 | cut -f 1 -d ':' | rev | cut -f 1 -d '/' | rev | sed -e 's%\.files$%%'`" #test if user-installed pkg. 120308
     #...return nothing if in Woof
     [ ! "$aPKGNAME" ] && [ -f "${PATHPREFIX}${BINEXEC}" ] && aPKGNAME="WOOF" #file is in Woof.
     [ ! "$aPKGNAME" ] && aPKGNAME="UNKNOWN"
 
     FNDMO=""
+    PREFIXLOCALEDIR='/usr/share/locale' #120308
     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
+    #120308 ROX-Filer is example where .mo is elsewhere. search all roxapps..
+    if [ ! "$FNDMO" ];then
+     FNDMO="`find /usr/local/apps -type f -name "${TEXTDOMAINVALUE}.mo"`"
+     TRANSLANG=$ORIGLANG1
+     PREFIXLOCALEDIR="`echo -n "$FNDMO" | sed -e 's%/LC_MESSAGES.*%%' | rev | cut -f 2-9 -d '/' | rev`" #ex: /usr/local/apps/ROX-Filer/Messages/de/LC_MESSAGES/ROX-Filer.mo, extract /usr/local/apps/ROX-Filer/Messages
+    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
+     echo "${PREFIXLOCALEDIR}/${TRANSLANG}/LC_MESSAGES/${TEXTDOMAINVALUE}.mo" >> /tmp/momanager/translations4langpack #120308
     else
      NOCNT=$(($NOCNT + 1))
      NOBIN_XML="${NOBIN_XML}
 <item>${BINEXEC} (${TEXTDOMAINVALUE} ${aPKGNAME})</item>"
     fi
@@ -712,24 +731,28 @@
    ;;
   esac
   #this syncs textdomain1.po and textdomain.pot, merges to textdomain.po ...
   rm -f ${ATEXTDOMAIN}.po 2>/dev/null
   LANG=${ORIGLANG} 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.
+  BINMSG="The .mo file has been converted to an editable .po file. Edit, then Save, then Quit text editor..."
+  ROPID=0
+  #120308 intltool-update is broken with some pot files. need a fallback method...
+  if [ ! -s ${ATEXTDOMAIN}.po ];then
+   LANG=${ORIGLANG} rxvt -e msginit --no-wrap --locale=${ORIGLANG12} --output-file=${ATEXTDOMAIN}.po --input=${ATEXTDOMAIN}.pot #create po file without any translations.
+   LANG=${ORIGLANG} defaulttextviewer /tmp/momanager/${ATEXTDOMAIN}1.po & #warning, this must be different from defaulttexteditor!
+   ROPID=$!
+   BINMSG="BAD NEWS: the 'intltool-update' utility was unable to merge your existing translations with the pot file. Therefore, the translations are open in a separate file '${ATEXTDOMAIN}1.po' and you must paste them into '${ATEXTDOMAIN}.po' -- edit the latter only! Edit '${ATEXTDOMAIN}.po', save, then quit..."
+  fi
+  poptop_func "$BINMSG"
   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
+  [ $ROPID -ne 0 ] && kill $ROPID
   LANG=${ORIGLANG} 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...
@@ -1322,46 +1345,55 @@
     ATRANSLANG="$ORIGLANG12"
    fi
    ANAME="`basename "$ABIN"`"
    AMO="${ATEXTDOMAIN}.mo"
   fi
-  AMOSPEC="/usr/share/locale/${ATRANSLANG}/LC_MESSAGES/${AMO}"
-
+  PREFIXLOCALEDIR='/usr/share/locale' #120308
+  #120308 there are exceptions to /usr/share/locale. unfortunately looks like i have to hard-code those...
+  case $ATEXTDOMAIN in
+   ROX-Filer) PREFIXLOCALEDIR='/usr/local/apps/ROX-Filer/Messages' ;;
+  esac
+  AMOSPEC="${PREFIXLOCALEDIR}/${ATRANSLANG}/LC_MESSAGES/${AMO}"
+  mkdir -p "${PREFIXLOCALEDIR}/${ATRANSLANG}/LC_MESSAGES" #120308
   cp -f /usr/share/doc/nls/${ATEXTDOMAIN}/${ATEXTDOMAIN}.pot /tmp/momanager/
   cd /tmp/momanager
-
+  ROPID=0
   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
    LANG=${ORIGLANG} rxvt -e intltool-update --dist --gettext-package=${ATEXTDOMAIN} --output-file=${ATEXTDOMAIN}.po ${ATEXTDOMAIN}1
+   BINMSG="A mo file has been converted to an editable po file. Edit, then Save, then Quit text editor..."
+   #120308 intltool-update is broken with ROX-Filer.pot. need a fallback method...
+   if [ ! -s ${ATEXTDOMAIN}.po ];then
+    LANG=${ORIGLANG} rxvt -e msginit --no-wrap --locale=${ORIGLANG12} --output-file=${ATEXTDOMAIN}.po --input=${ATEXTDOMAIN}.pot #create po file without any translations.
+    LANG=${ORIGLANG} defaulttextviewer /tmp/momanager/${ATEXTDOMAIN}1.po & #warning, this must be different from defaulttexteditor!
+    ROPID=$!
+    BINMSG="BAD NEWS: the 'intltool-update' utility was unable to merge your existing translations with the pot file. Therefore, the translations are open in a separate file '${ATEXTDOMAIN}1.po' and you must paste them into '${ATEXTDOMAIN}.po' -- edit the latter only! Edit '${ATEXTDOMAIN}.po', save, then quit..."
+   fi
   else
    LANG=${ORIGLANG} rxvt -e msginit --no-wrap --locale=${ORIGLANG12} --output-file=${ATEXTDOMAIN}.po --input=${ATEXTDOMAIN}.pot
-  fi
-
+   BINMSG="A po file is open for editing. Edit, then Save, then Quit text editor..."
+  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.
+  poptop_func "$BINMSG"
   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
+  [ $ROPID -ne 0 ] && kill $ROPID
   LANG=${ORIGLANG} 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/
+   mkdir -p /root/MoManager-${ORIGLANG12}-${APKGNAME}${PREFIXLOCALEDIR}/${ATRANSLANG}/LC_MESSAGES
+   cp -f /tmp/momanager/${ATEXTDOMAIN}.mo /root/MoManager-${ORIGLANG12}-${APKGNAME}${PREFIXLOCALEDIR}/${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

Changes to woof-code/rootfs-skeleton/usr/share/doc/nls/ROX-Filer/README.txt

@@ -15,7 +15,159 @@
 
 This line does it (plus a bit of editing by me):
 
 # msgfilter --keep-header  -i ROX-Filer.po  -o ROX-Filer.pot  awk -e '{}'
 
+Extract from the User Manual is below. It states that src/messages.pot exists in source,
+but it doesn't.
+The gist of the docs is that a .mo file has to be in a special location, for example:
+/usr/local/apps/ROX-Filer/Messages/de/LC_MESSAGES/ROX-Filer.mo
+
+The docs also state that /usr/local/apps/ROX-Filer/Options.xml has to be edited:
+
+"so that your language is listed, restart the filer and select it from the Options box
+       (see the <xref linkend="LANG"/> section)"
+
 Barry Kauler
 March 7, 2012
+
+INSTRUCTIONS FROM ROX-FILER USER MANUAL
+---------------------------------------
+
+ <chapter id="i18n">
+  <title>Internationalisation</title>
+  <para>
+
+  </para>
+
+  <sect1>
+   <title><anchor id="LANG" xreflabel="Translations"/>
+    Selecting a translation
+   </title>
+   <para>
+
+    <application>ROX-Filer</application> is able to translate many of its messages,
+    provided suitable translation files are provided:
+
+    <orderedlist>
+     <listitem><para>Open the Options box from the menu,</para></listitem>
+     <listitem><para>Select a language from the list,</para></listitem>
+     <listitem><para>Click on <guibutton>OK</guibutton> and restart the filer
+       for the new setting to take full effect.</para></listitem>
+    </orderedlist>
+
+   </para>
+  </sect1>
+
+  <sect1>
+   <title>Creating a new translation</title>
+   <para>
+
+    <orderedlist>
+     <listitem><para>Go into the <filename>src/po</filename> directory and create
+       the file <filename>src/messages.pot</filename>:
+
+       <screen>
+        $ cd ROX-Filer/src/po
+        $ ./update-po</screen>
+
+     </para></listitem>
+
+     <listitem><para>Copy the file into the <filename>src/po</filename>
+       directory as <filename>&lt;name&gt;.po</filename>. Eg, if your
+       language is referred to as `ml' (`my language'):
+
+       <screen>$ cp ../messages.pot ml.po</screen>
+     </para></listitem>
+
+     <listitem><para>Load the copy into a text editor.</para></listitem>
+
+     <listitem><para>Fill in the translations, which are all blank to start with.
+     </para></listitem>
+
+     <listitem><para>Run the <filename>make-mo</filename> script to create the
+       binary file which <application>ROX-Filer</application> can use.
+       You will need the GNU gettext package for this.
+
+       <screen>
+        $ cd ROX-Filer/src/po
+        $ ./make-mo ml
+        Created file ../../Messages/ml.gmo OK</screen>
+     </para></listitem>
+
+     <listitem><para>Edit <filename>ROX-Filer/Options.xml</filename> so that
+       your language is listed, restart the filer and select it from the Options box
+       (see the <xref linkend="LANG"/> section).
+     </para></listitem>
+
+     <listitem><para>Submit the <filename>.po</filename> file to the ROX
+     patch tracker so that we can include it in future releases of the filer.
+     </para></listitem>
+
+    </orderedlist>
+   </para>
+  </sect1>
+
+  <sect1>
+   <title>Updating an existing translation</title>
+   <para>
+
+    <orderedlist>
+     <listitem><para>Go into the directory containing the <filename>.po</filename>
+       files and run the <filename>update-po</filename> script.
+       This checks the source code for new and changed strings and updates all
+       the translation files.
+
+       <screen>
+        $ cd ROX-Filer/src/po
+        $ ./update-po</screen>
+     </para></listitem>
+
+     <listitem><para>Edit the file by hand as before, filling in the new blanks
+       and updating out-of-date translations.
+       Look out for <computeroutput>fuzzy</computeroutput> entries where
+       <command>update-po</command> has made a guess; check it's correct and
+       remove the <computeroutput>fuzzy</computeroutput> line.
+     </para></listitem>
+
+     <listitem><para>Run <command>make-mo</command> as before.</para></listitem>
+
+     <listitem><para>Submit the updated file to us.</para></listitem>
+
+    </orderedlist>
+
+    See the <command>gettext</command> info page for more instructions on creating
+    a translation.
+
+   </para>
+  </sect1>
+ </chapter>
+
+ ROX-FILER SCRIPTS
+ -----------------
+
+ The script src/po/make-mo:
+
+ #!/bin/sh
+
+if [ "$#" != 1 ]; then
+	cat << HERE
+Usage: 'make-mo <LANG>'
+Eg:    'make-mo fr' to compile the French translation, fr.po, ready for use.
+HERE
+	exit 1
+fi
+
+OUT_DIR=../../Messages
+LOCALE_DIR="$OUT_DIR/$1/LC_MESSAGES"
+OUT="$LOCALE_DIR/ROX-Filer.mo"
+mkdir -p "$LOCALE_DIR"
+
+# This code converts to UTF-8 format. Needed by Gtk+-2.0 at
+# least, and may help with other versions.
+charset=`grep "charset=" $1.po | head -1 | sed 's/^.*charset=\(.*\)\\\n.*/\1/'`
+echo Using charset \'$charset\'
+iconv -f $charset -t utf-8 $1.po | \
+	sed 's/; charset=\(.*\)\\n"/; charset=utf-8\\n"/' | \
+	msgfmt --statistics - -o $OUT && echo Created file $OUT OK
+
+