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

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

Revision 1.4, Mon Jul 20 01:44:48 2015 JST (8 years, 10 months ago) by hako
Branch: MAIN
Changes since 1.3: +18 -20 lines

cat

#!/bin/sh
# Translation of the home page
# by Hiroshi Hakoyama
# powered by sintl (by Kristaps Dzonsons) 
# example:
# cd www
# transl.sh

# timestamp
now=`date`
(rm index.xml; sed -e "s/dateModified\">\([^\"]*\)</dateModified\">$now</g" > index.xml) < 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`
  (rm ./${iso639}/index.html; \
    sed -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) < ./${iso639}/index.html
done

# remove sintl tags 
(rm index.html; \
  sed -e s/"its:translate=\"yes\""//g > index.html) < index.html

#ja modifications
(rm ./ja/index.html; \
  sed -e s/"http:\/\/hako.space\/publications\/"/"http:\/\/hako.space\/ja\/publications\/"/g > ./ja/index.html) < ./ja/index.html

(rm ./ja/index.html; \
  sed -e s/"http:\/\/hako.space\/talks\/"/"http:\/\/hako.space\/ja\/talks\/"/g > ./ja/index.html) < ./ja/index.html

(rm ./ja/index.html; \
  sed -e s/"http:\/\/hako.space\/CV\/"/"http:\/\/hako.space\/ja\/CV\/"/g > ./ja/index.html) < ./ja/index.html

(rm ./ja/index.html; \
  sed -e s/"http:\/\/hako.space\/course\/"/"http:\/\/hako.space\/ja\/course\/"/g > ./ja/index.html) < ./ja/index.html

(rm ./ja/index.html; \
  sed -e s/"http:\/\/hako.space\/about\/"/"http:\/\/hako.space\/ja\/about\/"/g > ./ja/index.html) < ./ja/index.html

exit 0