mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
language-update.sh:
- new parameter --obsolete to mark a text as obsolete git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1040 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
1 parent
1e71b525c4
commit
3e2b6c506f
1 file changed
+39
@@ -152,6 +152,33 @@ function addcomment() {
|
||||
} # end add_comment
|
||||
|
||||
|
||||
function obsolete() {
|
||||
for file in $filelist ; do
|
||||
# do not skip en.lang
|
||||
|
||||
line="$(grep "PALANG\['$text'\]" "$file")" || {
|
||||
echo "*** $file does not contain \$PALANG['$text'] ***" >&2
|
||||
continue
|
||||
}
|
||||
|
||||
newline="$line # obsolete"
|
||||
|
||||
# create patch
|
||||
echo "
|
||||
--- $file.old
|
||||
+++ $file
|
||||
@@ -1,1 +1,1 @@
|
||||
-$line
|
||||
+$newline
|
||||
" > "$file.patch"
|
||||
|
||||
test $patch = 0 && cat $file.patch
|
||||
test $patch = 1 && patch $file < $file.patch
|
||||
done
|
||||
} # end add_comment
|
||||
|
||||
|
||||
|
||||
|
||||
function cleanup() {
|
||||
# check for duplicated strings
|
||||
@@ -241,6 +268,11 @@ echo '
|
||||
Useful if a string needs to be translated again.
|
||||
|
||||
|
||||
'"$0"' --obsolete string [--patch] [--nocleanup] [foo.lang [bar.lang [...] ] ]
|
||||
|
||||
Mark $PALANG['"'"'string'"'"'] as obsolete / no longer used
|
||||
|
||||
|
||||
'"$0"' --forcepatch [foo.lang [bar.lang [...] ] ]
|
||||
|
||||
Similar to --patch, but applies the patch line by line. Useful if --patch
|
||||
@@ -280,6 +312,7 @@ rename=0 # rename a string
|
||||
remove=0 # remove a string
|
||||
stats=0 # create translation statistics
|
||||
addcomment=0 # add translation comment
|
||||
obsolete=0 # add obsolete note
|
||||
text=''
|
||||
comment=''
|
||||
rename_old=''
|
||||
@@ -322,6 +355,12 @@ while [ -n "$1" ] ; do
|
||||
echo "$comment" | grep '^[a-z_-]*\.lang$' && comment='' # error out on *.lang - probably a filename
|
||||
test -z "$comment" && { echo '--addcomment needs two parameters' >&2 ; exit 1 ; }
|
||||
;;
|
||||
--obsolete)
|
||||
obsolete=1
|
||||
shift ; text="$1"
|
||||
echo "$text" | grep '^[a-z_-]*\.lang$' && comment='' # error out on *.lang - probably a filename
|
||||
test -z "$text" && { echo '--addcomment needs a parameter' >&2 ; exit 1 ; }
|
||||
;;
|
||||
--forcepatch)
|
||||
forcepatch=1
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user