| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_printActionPreamble { |
| |
| local FILES="$1" |
| |
| |
| |
| if [[ "$FILES" == '' ]];then |
| return |
| fi |
| |
| local ACTION="$2" |
| local FORMAT="$3" |
| local FILE='' |
| local NEGATIVE='' |
| local POSITIVE='' |
| local COUNT=0 |
| |
| |
| FILES=$(echo "$FILES" | sed -r "s! +!\n!g") |
| |
| |
| COUNT=$(echo "$FILES" | wc -l) |
| |
| |
| |
| |
| case $ACTION in |
| |
| 'doCreate' ) |
| if [[ $FILES == '' ]];then |
| NEGATIVE="`gettext "There is no entry to create."`" |
| else |
| POSITIVE="`ngettext "The following entry will be created" \ |
| "The following entries will be created" $COUNT`:" |
| fi |
| ;; |
| |
| 'doDelete' ) |
| if [[ $FILES == '' ]];then |
| NEGATIVE="`gettext "There is no file to delete."`" |
| else |
| POSITIVE="`ngettext "The following entry will be deleted" \ |
| "The following entries will be deleted" $COUNT`:" |
| fi |
| ;; |
| |
| 'doLocale' ) |
| if [[ $FILES == '' ]];then |
| NEGATIVE="`gettext "There is no file to locale."`" |
| else |
| POSITIVE="`ngettext "Translatable strings will be retrived from the following entry" \ |
| "Translatable strings will be retrived from the following entries" $COUNT`:" |
| fi |
| ;; |
| |
| 'doEdit' ) |
| if [[ $FILES == '' ]];then |
| NEGATIVE="`gettext "There is no file to edit."`" |
| else |
| POSITIVE="`ngettext "The following file will be edited" \ |
| "The following files will be edited" $COUNT`:" |
| fi |
| ;; |
| |
| * ) |
| |
| |
| |
| |
| if [[ "$FILES" == '' ]];then |
| NEGATIVE="`gettext "There is no file to process."`" |
| fi |
| ;; |
| |
| esac |
| |
| |
| if [[ $POSITIVE != '' ]] && [[ $NEGATIVE == '' ]];then |
| cli_printMessage "$POSITIVE" |
| for FILE in $FILES;do |
| cli_printMessage "$FILE" "$FORMAT" |
| done |
| cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine' |
| elif [[ $POSITIVE == '' ]] && [[ $NEGATIVE != '' ]];then |
| cli_printMessage "$NEGATIVE" 'AsErrorLine' |
| cli_printMessage "${FUNCDIRNAM}" 'AsToKnowMoreLine' |
| fi |
| |
| } |