#!/bin/sh
# test we are root
if [ "$(id -u)" != "0" ]; then
   exit 1
fi

export CFLAGS="-mtune=generic -Os -pipe"
export CXXFLAGS="-mtune=generic -Os -pipe -fno-exceptions -fno-rtti"
# compiletc loads gawk

P=translate-shell
V=0.9.7.1
SRC=$P-$V
USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc submitqc "
for Z in $LIST 
    do 
    su -c "tce-load -i $Z" $USER
done

cd /tmp
/usr/local/bin/wget -nc --no-check-certificate \
https://github.com/soimort/$P/archive/refs/tags/v$V.tar.gz
tar xvf v*gz
cd $SRC
make -j6 # 1 second
make install DESTDIR=/tmp/$P
cd /tmp

# doc
######
mkdir -p $P-doc/usr/local/share/doc/$P
mv $P/usr/local/share/man $P-doc/usr/local/share/
chmod 644 $P-doc/usr/local/share/man/man1/trans.1
cp $SRC/README.md $P-doc/usr/local/share/doc/$P

# main
######
mkdir -p $P/usr/local/share/doc/$P
cp $SRC/WAIVER $P/usr/local/share/doc/$P/COPYING

# TCZ them
#######
LIST="$P $P-doc  "
for Z in $LIST
do
	mksquashfs $Z $Z.tcz
	md5sum $Z.tcz > $Z.tcz.md5.txt
	cd $Z
	find . -not -type d | cut -c 2- | sort > /tmp/$Z.tcz.list
	cd /tmp
done

ls -hal 

echo 'Title:          translate-shell-doc.tcz
Description:    man page and readme 
Version:        0.9.7.1
Author:         Mort Yao
Original-site:  https://github.com/soimort/translate-shell
Copying-policy: copyright waiver 
Size:           20K
Extension_by:   aus9 
Tags:           translate
Comments:       I believe its important that you read
                both the man page and README
                
Change-log:     2026/01/08 v 0.9.7 
Current:        2026/01/08   '  > $P-doc.tcz.info
echo 'man-db.tcz '  > $P-doc.tcz.dep

echo "Title:          translate-shell.tcz
Description:    Translation tool console or virtual terminal as below
Version:        0.9.7.1
Author:         Mort Yao
Original-site:  https://github.com/soimort/translate-shell
Copying-policy: copyright waiver
Size:           72K
Extension_by:   aus9 
Tags:           translate
Comments:       Translates text into any language from the command-line, 
                using Google Translate, Bing Translator or Yandex.Translate
                Can also be used like an interactive shell, input the text 
                to be translated line by line. Can convert txt to sound file 
                or sound device if capable (use the -p for play)

                It is ESSENTIAL that you read the man page/README as
                'Each argument which is not a valid option is treated as 
                TEXT to be translated.'

                Use an  UTF-8 terminal AND load any fonts you might need to
                display input or output font before running the executable.
                Locale must be set, follow the info from getlocale and its output Please
         
                If you like Sound - Setup sound first then - 
                    Choose mpg123, mpv, mplayer or 
                    direct to sound device = espeak-ng
 
                Other TCEs
                aspell* depends on your native language 
                non-EN to EN translations - aspell-en
                (But for simple test I have no aspell loaded)
                Other aspells* see GUI search result for aspell
                fribidi for right to left languages
                
                curl for networks (pulls in ca-certificates) but 
                I did not need curl for basic translation single lines

                Simple one line by line EXAMPLE
                drop -p if you want no sound output
                ###################################
                trans -b -p # NOTE -bp is treated as TEXT as above!
                J'adore Linux 
                I love Linux # with mpg123 loaded a voice spoke to me
                Dónde estoy
                where am I 
                    我在哪里     # You need wqy-zenhei-fonts-ttf to see font
                where am i
                (ctrl + c to close)
               
Change-log:     2022/10/07 v 0.9.7 (tiagoarcosta)
Current:        2026/01/08 v 0.9.7.1 on 17x (aus9) "  > $P.tcz.info
# bash script mentions gawk

echo 'bash.tcz
gawk.tcz ' > $P.tcz.dep

submitqc --libs
rm -rf *.zsync


