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 " -NS|--new-as-secondary - use newly translated file translations"
|
||||||
echo " as secondary (default - use the new files"
|
echo " as secondary (default - use the new files"
|
||||||
echo " as primary translations)"
|
echo " as primary translations)"
|
||||||
echo " -s|--silent - suppress msgmerge output"
|
echo " -v|--verbose - print msgmerge output"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ do
|
||||||
option_new_as_secondary="Y"
|
option_new_as_secondary="Y"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-s|--silent)
|
-v|--verbose)
|
||||||
option_silent="Y"
|
option_verbose="Y"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-*|--*)
|
-*|--*)
|
||||||
|
@ -64,7 +64,7 @@ upd_dir=$1
|
||||||
tra_tree=$2
|
tra_tree=$2
|
||||||
tpl_tree=$3
|
tpl_tree=$3
|
||||||
|
|
||||||
if [ ! "$option_silent" = "Y" ]; then
|
if [ "$option_verbose" = "Y" ]; then
|
||||||
echo "Checking if updated files are in the specified directory ..."
|
echo "Checking if updated files are in the specified directory ..."
|
||||||
else
|
else
|
||||||
total_files=`find $upd_dir -name "*.po" | wc -l`
|
total_files=`find $upd_dir -name "*.po" | wc -l`
|
||||||
|
@ -77,7 +77,7 @@ if [ "$newtrans" == "" ]; then
|
||||||
echo " ... no updated files found in: $upd_dir"
|
echo " ... no updated files found in: $upd_dir"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
if [ ! "$option_silent" = "Y" ]; then
|
if [ "$option_verbose" = "Y" ]; then
|
||||||
echo " ... they are."
|
echo " ... they are."
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
@ -106,7 +106,7 @@ if [ `cd $tra_tree; find ${updfile} 2> /dev/null | wc -l` -gt 1 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ `cd $tpl_tree; find ${updfile}t 2> /dev/null | wc -l` -lt 1 ]; then
|
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
|
||||||
echo "File `basename $updfile` does not belong to this translation project,"
|
echo "File `basename $updfile` does not belong to this translation project,"
|
||||||
echo "SKIPPING..."
|
echo "SKIPPING..."
|
||||||
|
@ -134,7 +134,7 @@ fi
|
||||||
mv $tra_tree/$trafile $tra_tree/${trafile}.old
|
mv $tra_tree/$trafile $tra_tree/${trafile}.old
|
||||||
|
|
||||||
if [ ! "$option_new_as_secondary" = "Y" ]; then
|
if [ ! "$option_new_as_secondary" = "Y" ]; then
|
||||||
if [ ! "$option_silent" = "Y" ]; then
|
if [ "$option_verbose" = "Y" ]; then
|
||||||
echo
|
echo
|
||||||
echo "UPDATING $trafile using translations from $upd_dir/$updfile as SECONDARY translations"
|
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
|
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
|
msgmerge -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile 2> /dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ ! "$option_silent" = "Y" ]; then
|
if [ "$option_verbose" = "Y" ]; then
|
||||||
echo
|
echo
|
||||||
echo "UPDATING $trafile using translations from $upd_dir/$updfile as PRIMARY translations"
|
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
|
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}.new
|
||||||
rm $tra_tree/${trafile}.old
|
rm $tra_tree/${trafile}.old
|
||||||
|
|
||||||
if [ "$option_silent" = "Y" ]; then
|
if [ ! "$option_verbose" = "Y" ]; then
|
||||||
merged_files=$(($merged_files+1))
|
merged_files=$(($merged_files+1))
|
||||||
echo -ne "\r$merged_files/$total_files merged"
|
echo -ne "\r$merged_files/$total_files merged"
|
||||||
if [ ! $skipped_files -eq 0 ]; then
|
if [ ! $skipped_files -eq 0 ]; then
|
||||||
|
@ -166,6 +166,6 @@ fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$option_silent" = "Y" ]; then
|
if [ ! "$option_verbose" = "Y" ]; then
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue