I wanted to play freeorion in Japanese
I wrote this code to translate freeorion into Japanese.
I moved freeorion/default/stringtables/en.txt in the same folder.
Code: Select all
#!/bin/bash
while IFS= read line
do
if [[ $line =~ ^#.* ]] ; then
echo $line
elif [[ $line =~ ^[A-z].* ]] ; then
echo $line
read twice
if [[ $twice =~ .*%.* ]] ; then
echo $twice
elif [[ $twice =~ .*\(.* ]] ; then
echo $twice
elif [[ $twice =~ .*\[.* ]] ; then
echo $twice
elif [[ $twice =~ .*\{.* ]] ; then
echo $twice
elif [[ $twice =~ .*\<.* ]] ; then
echo $twice
elif [[ $twice =~ ^[A-z].* ]] ; then
trans :ja -b $twice -no-auto
sleep 10
else
echo $twice
fi
else
echo $line
fi
#trans :ja -b $line -no-auto
done < ./en.txt
Code: Select all
translate.sh >new.txt
But it moved halfway.
I am a shell beginner.
If you ask some advice, I think it will work.
translate.sh
I am Japanese.,I may made a mistake in grammar.