language-update.sh:

- new parameter --comparetext to compare two texts in $PALANG.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1138 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 15 years ago
parent b065366a91
commit 80389ec0e3

@ -15,7 +15,7 @@
# File: language-update.sh
# Lists missing translations in language files and optionally patches the
# english texts into the language file.
# Can also rename a $PALANG string.
# Can also do several other things that help handling the language files - see --help.
#
# written by Christian Boltz
@ -179,6 +179,18 @@ function obsolete() {
function comparetext() {
for file in $filelist ; do
echo "<?php
include('$file');
if (\$PALANG['$text1'] != \$PALANG['$text2']) {
echo '$file: ' . \$PALANG['$text1'] . ' --- ' . \$PALANG['$text2'] . \"\\n\";
}
" | php
done
}
function cleanup() {
# check for duplicated strings
@ -283,6 +295,13 @@ echo '
success message :-) (no difference remaining)
'"$0"' --comparetext string1 string2 [foo.lang [bar.lang [...] ] ]
Compare two texts in $PALANG.
This can be useful to find out if two equel texts in $PALANG are the
same in all languages. No output means no difference.
'"$0"' --stats
Print translation statistics to postfixadmin-languages.txt
@ -313,6 +332,7 @@ remove=0 # remove a string
stats=0 # create translation statistics
addcomment=0 # add translation comment
obsolete=0 # add obsolete note
comparetext=0 # compare two PALANG texts
text=''
comment=''
rename_old=''
@ -325,6 +345,12 @@ while [ -n "$1" ] ; do
usage
exit 0;
;;
--comparetext)
comparetext=1
shift; text1="$1"
shift; text2="$1"
test -z "$text2" && { echo '--comparetext needs two parameters' >&2 ; exit 1; }
;;
--notext)
notext=1
;;
@ -388,6 +414,7 @@ test "$rename" = 1 && { rename_string ; cleanup ; exit 0 ; }
test "$remove" = 1 && { remove_string ; cleanup ; exit 0 ; }
test "$obsolete" = 1 && { obsolete ; cleanup ; exit 0 ; }
test "$forcepatch" = 1 && { forcepatch ; cleanup ; exit 0 ; }
test "$comparetext" = 1 && { comparetext ; cleanup ; exit 0 ; }
test "$stats" = 1 && { statistics ; exit 0 ; }

Loading…
Cancel
Save