Use silent poupdate mode by default. Add -v|--verbose flag.
This commit is contained in:
parent
61ff790ba2
commit
705e6f4d3d
20
poupdate
20
poupdate
|
@ -29,7 +29,7 @@ function usage() {
|
|||
echo " -NS|--new-as-secondary - use newly translated file translations"
|
||||
echo " as secondary (default - use the new files"
|
||||
echo " as primary translations)"
|
||||
echo " -s|--silent - suppress msgmerge output"
|
||||
echo " -v|--verbose - print msgmerge output"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ do
|
|||
option_new_as_secondary="Y"
|
||||
shift
|
||||
;;
|
||||
-s|--silent)
|
||||
option_silent="Y"
|
||||
-v|--verbose)
|
||||
option_verbose="Y"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
|
@ -64,7 +64,7 @@ upd_dir=$1
|
|||
tra_tree=$2
|
||||
tpl_tree=$3
|
||||
|
||||
if [ ! "$option_silent" = "Y" ]; then
|
||||
if [ "$option_verbose" = "Y" ]; then
|
||||
echo "Checking if updated files are in the specified directory ..."
|
||||
else
|
||||
total_files=`find $upd_dir -name "*.po" | wc -l`
|
||||
|
@ -77,7 +77,7 @@ if [ "$newtrans" == "" ]; then
|
|||
echo " ... no updated files found in: $upd_dir"
|
||||
exit 1
|
||||
else
|
||||
if [ ! "$option_silent" = "Y" ]; then
|
||||
if [ "$option_verbose" = "Y" ]; then
|
||||
echo " ... they are."
|
||||
echo
|
||||
fi
|
||||
|
@ -106,7 +106,7 @@ if [ `cd $tra_tree; find ${updfile} 2> /dev/null | wc -l` -gt 1 ]; then
|
|||
fi
|
||||
|
||||
if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then
|
||||
if [ ! "$option_silent" = "Y" ]; then
|
||||
if [ "$option_verbose" = "Y" ]; then
|
||||
echo
|
||||
echo "File `basename $updfile` does not belong to this translation project,"
|
||||
echo "SKIPPING..."
|
||||
|
@ -134,7 +134,7 @@ fi
|
|||
mv $tra_tree/$trafile $tra_tree/${trafile}.old
|
||||
|
||||
if [ ! "$option_new_as_secondary" = "Y" ]; then
|
||||
if [ ! "$option_silent" = "Y" ]; then
|
||||
if [ "$option_verbose" = "Y" ]; then
|
||||
echo
|
||||
echo "UPDATING $trafile using translations from $upd_dir/$updfile as SECONDARY translations"
|
||||
msgmerge -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile
|
||||
|
@ -142,7 +142,7 @@ if [ ! "$option_new_as_secondary" = "Y" ]; then
|
|||
msgmerge -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile 2> /dev/null
|
||||
fi
|
||||
else
|
||||
if [ ! "$option_silent" = "Y" ]; then
|
||||
if [ "$option_verbose" = "Y" ]; then
|
||||
echo
|
||||
echo "UPDATING $trafile using translations from $upd_dir/$updfile as PRIMARY translations"
|
||||
msgmerge -N -v --compendium=$tra_tree/${trafile}.old -o $tra_tree/${trafile}.new $upd_dir/$updfile $tpl_tree/$tplfile
|
||||
|
@ -156,7 +156,7 @@ cat $tra_tree/${trafile}.new | sed '/X-Rosetta-Export-Date/d' > $tra_tree/$trafi
|
|||
rm $tra_tree/${trafile}.new
|
||||
rm $tra_tree/${trafile}.old
|
||||
|
||||
if [ "$option_silent" = "Y" ]; then
|
||||
if [ ! "$option_verbose" = "Y" ]; then
|
||||
merged_files=$(($merged_files+1))
|
||||
echo -ne "\r$merged_files/$total_files merged"
|
||||
if [ ! $skipped_files -eq 0 ]; then
|
||||
|
@ -166,6 +166,6 @@ fi
|
|||
|
||||
done
|
||||
|
||||
if [ "$option_silent" = "Y" ]; then
|
||||
if [ ! "$option_verbose" = "Y" ]; then
|
||||
echo
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue