[BACK]Return to transl.sh CVS log [TXT][DIR] Up to [local] / web

File: [local] / web / transl.sh (download)

Revision 1.8, Sat Dec 1 20:47:03 2018 JST (5 years, 5 months ago) by hako
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +3 -0 lines

sintl-0.1.2 is necessary

#!/bin/sh
# Translation of the home page
# by Hiroshi Hakoyama
# powered by sintl (by Kristaps Dzonsons) 
# example:
# cd www
# transl.sh
# note:
# Use sintl-0.1.2 for XLIFF 2.0 (<= sintl-0.2.3 uses XLIFF 1.2 but 2.0)
# todo: Should I revert the XLIFF version to 1.2?

# timestamp
now=`date`
sed -i -e "s/dateModified\">[^<]*</dateModified\">$now</g" index.xml

cp index.xml index.html

descr_en=`grep name=\"description\" index.html | sed -e 's/^.*content=\"//' -e 's/\".*>//'` 
keywd_en=`grep name=\"keywords\" index.html | sed -e 's/^.*content=\"//' -e 's/\".*>//'`

for iso639 in `ls -F ~/web/keywords/$@ | grep -v /` ; do
  if [ ! -e $iso639 ]; then mkdir $iso639; fi
  sintl -j ~/web/xlf/${iso639}.xlf index.html > ./${iso639}/index.html
  descr_transl=`cat ~/web/description/$iso639`
  keywd_transl=`cat ~/web/keywords/$iso639`
  sed -i -e 2s/en/$iso639/ \
         -e s/"\ its:translate=\"yes\""//g \
         -e s/"$descr_en"/"$descr_transl"/g \
         -e s/"$keywd_en"/"$keywd_transl"/g ./${iso639}/index.html 
done

# remove sintl tags 
sed -i -e s/"its:translate=\"yes\""//g index.html

#ja modifications
sed -i -e s/"\/about"/"\/ja\/about"/g \
       -e s/"\/CV"/"\/ja\/CV"/g \
       -e s/"\/publications"/"\/ja\/publications"/g \
       -e s/"\/talks"/"\/ja\/talks"/g \
       -e s/"\/course"/"\/ja\/course"/g ./ja/index.html

exit 0