| 1 | #! /bin/bash |
|---|
| 2 | |
|---|
| 3 | # Movable Type (r) Open Source (C) 2001-2009 Six Apart, Ltd. |
|---|
| 4 | # This program is distributed under the terms of the |
|---|
| 5 | # GNU General Public License, version 2. |
|---|
| 6 | # |
|---|
| 7 | # $Id:$ |
|---|
| 8 | # |
|---|
| 9 | # to make XX.pm, |
|---|
| 10 | # $ cd /PATH/TO/MT_ROOT_DIR |
|---|
| 11 | # $ build/l10n/make-l10n XX |
|---|
| 12 | # you can get XX in $TEMP_DIR |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | TEMP_DIR=/tmp |
|---|
| 16 | SCRIPT_DIR=build/l10n |
|---|
| 17 | |
|---|
| 18 | if [ -n $1 ]; then |
|---|
| 19 | TARGET=$1 |
|---|
| 20 | fi |
|---|
| 21 | |
|---|
| 22 | if [ -z $TARGET ]; then |
|---|
| 23 | TARGET=ja |
|---|
| 24 | fi |
|---|
| 25 | |
|---|
| 26 | echo "in php..." |
|---|
| 27 | find php -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 28 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 29 | echo "in cgi..." |
|---|
| 30 | find *.cgi -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 31 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 32 | echo "in default_templates..." |
|---|
| 33 | find default_templates -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 34 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 35 | echo "in lib..." |
|---|
| 36 | find lib -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 37 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 38 | echo "in mt-static..." |
|---|
| 39 | find mt-static -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 40 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 41 | echo "in search_templates..." |
|---|
| 42 | find search_templates -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 43 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 44 | echo "in tmpl..." |
|---|
| 45 | find tmpl -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" | \ |
|---|
| 46 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 47 | echo "in addons..." |
|---|
| 48 | find addons -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.cfg" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" -or -name "*.yaml" | \ |
|---|
| 49 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 50 | echo "in plugins..." |
|---|
| 51 | find plugins -type f -name "*.cgi" -or -name "*.pm" -or -name "*.pl" -or -name "*.cfg" -or -name "*.tmpl" -or -name "*.php" -or -name "*.pre" -or -name "*.js" -or -name "*.mtml" -or -name "*.yaml" | \ |
|---|
| 52 | awk -v target=$TARGET -v dir=$SCRIPT_DIR '{print "perl", dir "/trans.pl -t lib/MT/L10N/" target ".pm", $1 }' | bash >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 53 | perl $SCRIPT_DIR/diff.pl -old lib/MT/L10N/$TARGET.pm -target $TEMP_DIR/$TARGET-base.pm -new $TEMP_DIR/$TARGET-nodupe.pm > $TEMP_DIR/$TARGET-old.pm |
|---|
| 54 | #cat $TEMP_DIR/$TARGET-old.pm >> $TEMP_DIR/$TARGET-base.pm |
|---|
| 55 | cat $TEMP_DIR/$TARGET-base.pm | perl $SCRIPT_DIR/wrap.pl $TARGET > $TEMP_DIR/$TARGET.pm |
|---|
| 56 | #perl -Ilib -cw $TEMP_DIR/$TARGET.pm |
|---|
| 57 | #rm -f $TEMP_DIR/$TARGET-*.pm |
|---|