From 73abe01cd4b177ab050c145f6adb1c85e2f0b4f3 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Mar 12 2011 18:22:13 +0000 Subject: Update locale.sh. --- diff --git a/Scripts/Bash/Cli/Functions/Locale/locale.sh b/Scripts/Bash/Cli/Functions/Locale/locale.sh index a64e3ed..2f320f3 100644 --- a/Scripts/Bash/Cli/Functions/Locale/locale.sh +++ b/Scripts/Bash/Cli/Functions/Locale/locale.sh @@ -26,13 +26,80 @@ function locale { + local ACTIONNAM='' + local ACTIONVAL='' + # Initialize default value to create/update machine object flag. # The machine object flag (--dont-create-mo) controls whether # centos-art.sh script does create/update the machine object # related object or not. local FLAG_DONT_CREATE_MO='false' - # Define the command-line interface. - locale_getActions + # Interpret arguments and options passed through command-line. + locale_getArguments + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "$ARGUMENTS" + + # Define action name. It does matter what option be passed to + # centos-art, there are many different actions to perform based on + # the option passed (e.g., `--edit', `--read', `--search', etc.). + # In that sake, we defined action name inside document_getArguments, + # at the moment of interpreting options. + + # Define action value. As convenction, we use non-option arguments + # to define the action value (ACTIONVAL) variable. + for ACTIONVAL in "$@";do + + if [[ $ACTIONVAL == '--' ]];then + continue + fi + + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource + + # Define locales base directory where locale directory structures + # are stored in. + local BASEDIR="$(cli_getRepoTLDir)/Locales" + + # Define locales work directory. This is the place where + # locale files (e.g., .po, .pot, .mo), for a specific parent + # directories, are stored in. There is one locale work + # directory for each parent directory or said differently, + # each parent directory has a parallel directory under + # `trunk/Locales' to store its translation messages. + local WORKDIR=$(echo ${ACTIONVAL} \ + | sed -r -e 's!trunk/(Identity|Manuals|Scripts)!trunk/Locales/\1!') + + # Create work directory, if it doesn't exist. + if [[ ! -d $WORKDIR ]];then + mkdir -p $WORKDIR + fi + + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. + cli_syncroRepoChanges "${WORKDIR}" + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Commit changes from working copy to central repository only. + # At this point, changes in the repository are not merged in + # the working copy, but chages in the working copy do are + # committed up to repository. + cli_commitRepoChanges "${WORKDIR}" + + done }