From e8f8e00fd97c82bbef682a05bbc8ad688b0a7bc8 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Sep 23 2013 20:35:35 +0000 Subject: Update the locale module of centos-art.sh script. - Previously, some of the most important module environment variables were defined in the ${MODULE_NAME}.conf.sh file. Using the ${MODULE_NAME}.conf.sh file was discontinued a few days ago and variables inside them were undefined making the locale module to fail. This update changes ${MODULE_NAME}.sh files to initialize module environment variables in them making the locale module to work as expected. - Previously, we were using tcar_setModuleEnvironment function to load both modules and submodules inside centos-art.sh script without any different. Now, because we want to load first-level modules from sub-modules, we use tcar_setModuleEnvironment to load first-level modules only and tcar_setSubModuleEnvironment to load sub-modules at different levels only. This update changes the files inside the locale module to start using both tcar_setModuleEnvironment and tcar_setSubModuleEnvironment functions when loading first-level modules and sub-modules. - Inside locale.sh and locale_getOptions.sh, rename variable from ACTIONS to SUBMODULES. - Previously, we were using the ${MODULE_NAME}.asciidoc file name in documentation manuals. This might bring confusion with other commands outside centos-art.sh script. So, to avoid such confusion, this udpate changes the documentation manual file name from ${MODULE_NAME}.asciidoc to centos-art.sh-${MODULE_NAME}.asciidoc. - Remove locale.sh.asciidoc and locale.conf.sh.asciidoc files from documentation manuals. Environment information will be handle inside centos-art.sh-locale.asciidoc documentation manual. --- diff --git a/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc b/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc index c62cbaf..1d32294 100644 --- a/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc +++ b/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc @@ -10,7 +10,17 @@ images, documents and automation scripts. Synopsis -------- -centos-art.sh locale [OPTIONS] [DIRECTORY ...|FILE ...] +*centos-art.sh locale --help*:: + Print module's documentation. + +*centos-art.sh locale --version*:: + Print module's version. + +*centos-art.sh locale DIRECTORY [--update|--edit|--delete|--filter="REGEX"]*:: + Perform directory localization. + +*centos-art.sh locale FILE [--update|--edit|--delete]*:: + Perform file localization. Description ----------- diff --git a/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc.pot b/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc.pot deleted file mode 100644 index 80649dc..0000000 --- a/Automation/Modules/Locale/Manuals/centos-art.sh-locale.asciidoc.pot +++ /dev/null @@ -1,168 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2013-08-06 01:51-0400\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "centos-art.sh-locale" -msgstr "" - -msgid "1" -msgstr "" - -msgid "" -"Retrieve, edit and delete translation files for images, documents " -"and automation scripts." -msgstr "" - -msgid "centos-art.sh locale [OPTIONS] [DIRECTORY …|FILE …]" -msgstr "" - -msgid "Description" -msgstr "" - -msgid "" -"The locale produces " -"translations files for images, documents and automation scripts " -"based on the current locale information. In order to produce locale-" -"specific translation files, the current language information set by " -"the LANG environment variable must be different to English (`en'). " -"If the current language is English, the locale module ends its execution with an error " -"message. When the current language is different to English, the " -"locale looks for source files, " -"based on the arguments you passed through the command-line." -msgstr "" - -msgid "" -"When the argument you provided is a “DIRECTORY”, the locale module looks for configuration files " -"inside it and produces translation files based on the render-from and locale-from variables set in there. On the other " -"hand, when a “FILE” is provided, it takes the file extension (i.e., " -"the characters after the last dot in the file name) and looks " -"recursively in the file's directory for all the files that have the " -"same file extension the “FILE” does, and builds the list of source " -"files that will be used to produce the translation files. In this " -"case, the translation files are stored in a “Locales” directory, at " -"the same level of the “FILE” you provided as argument to locale module's command-line." -msgstr "" - -msgid "" -"Translation files are the files we use to store translatable " -"strings. These files can be either portable objects (." -"po'), machine objects (.po') or portable object templates " -"(.pot'). Machine objects are built from portable objects. " -"Portable objects are built from portable object templates (.pot'). Portable object templates are built using xgettext or xml2po programs, according to the source files you " -"are retrieving translatable strings from. From these files, " -"portable objects (.po') are used by render module to produce both localized images and " -"localized documentation while machine objects (.mo') are " -"used by gettext program to " -"produce localized output messages from automation scripts." -msgstr "" - -msgid "Options" -msgstr "" - -msgid "" -"The locale module accepts the " -"following options:" -msgstr "" - -msgid "-h, --help" -msgstr "" - -msgid "--filter=\"REGEX\"" -msgstr "" - -msgid "" -"When “DIRECTORY” is passed as argument, this option reduces the " -"number of section blocks inside configuration files the locale module will take for processing " -"by using the “REGEX” value is a regular expression pattern to match " -"one or more section names inside the configuration files found " -"under “DIRECTORY”. When “FILE” is passed as argument, in the other " -"hand, it limits the number of files that will be set in the list of " -"source files used to build the final translation files." -msgstr "" - -msgid "--update" -msgstr "" - -msgid "--edit" -msgstr "" - -msgid "--delete" -msgstr "" - -msgid "Localizing Image Files" -msgstr "" - -#, no-wrap -msgid "" -"\n" -"Hi\n" -"\n" -"Localizing Documentation Files" -msgstr "" - -msgid "Hi" -msgstr "" - -msgid "Localizing Automation Scripts" -msgstr "" - -msgid "Author" -msgstr "" - -msgid "" -"Written by Alain Reguera " -"Delgado" -msgstr "" - -msgid "Copyright" -msgstr "" - -msgid "Copyright © 2009-2013 The CentOS Project" -msgstr "" - -msgid "" -"This program is free software; you can redistribute it and/or " -"modify it under the terms of the GNU General Public License as " -"published by the Free Software Foundation; either version 2 of the " -"License, or (at your option) any later version." -msgstr "" - -msgid "" -"This program is distributed in the hope that it will be useful, but " -"WITHOUT ANY WARRANTY; without even the implied warranty of " -"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU " -"General Public License for more details." -msgstr "" - -msgid "" -"You should have received a copy of the GNU General Public License " -"along with this program; if not, write to the Free Software " -"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." -msgstr "" - -msgid "See Also" -msgstr "" - -msgid "centos-art.sh(1), centos-art.sh-render(1), gettext(1)" -msgstr "" - -#. Put one translator per line, in the form of NAME , YEAR1, YEAR2. -msgid "translator-credits" -msgstr "" diff --git a/Automation/Modules/Locale/Manuals/centos-art.sh-locale.pot b/Automation/Modules/Locale/Manuals/centos-art.sh-locale.pot new file mode 100644 index 0000000..80649dc --- /dev/null +++ b/Automation/Modules/Locale/Manuals/centos-art.sh-locale.pot @@ -0,0 +1,168 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2013-08-06 01:51-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "centos-art.sh-locale" +msgstr "" + +msgid "1" +msgstr "" + +msgid "" +"Retrieve, edit and delete translation files for images, documents " +"and automation scripts." +msgstr "" + +msgid "centos-art.sh locale [OPTIONS] [DIRECTORY …|FILE …]" +msgstr "" + +msgid "Description" +msgstr "" + +msgid "" +"The locale produces " +"translations files for images, documents and automation scripts " +"based on the current locale information. In order to produce locale-" +"specific translation files, the current language information set by " +"the LANG environment variable must be different to English (`en'). " +"If the current language is English, the locale module ends its execution with an error " +"message. When the current language is different to English, the " +"locale looks for source files, " +"based on the arguments you passed through the command-line." +msgstr "" + +msgid "" +"When the argument you provided is a “DIRECTORY”, the locale module looks for configuration files " +"inside it and produces translation files based on the render-from and locale-from variables set in there. On the other " +"hand, when a “FILE” is provided, it takes the file extension (i.e., " +"the characters after the last dot in the file name) and looks " +"recursively in the file's directory for all the files that have the " +"same file extension the “FILE” does, and builds the list of source " +"files that will be used to produce the translation files. In this " +"case, the translation files are stored in a “Locales” directory, at " +"the same level of the “FILE” you provided as argument to locale module's command-line." +msgstr "" + +msgid "" +"Translation files are the files we use to store translatable " +"strings. These files can be either portable objects (." +"po'), machine objects (.po') or portable object templates " +"(.pot'). Machine objects are built from portable objects. " +"Portable objects are built from portable object templates (.pot'). Portable object templates are built using xgettext or xml2po programs, according to the source files you " +"are retrieving translatable strings from. From these files, " +"portable objects (.po') are used by render module to produce both localized images and " +"localized documentation while machine objects (.mo') are " +"used by gettext program to " +"produce localized output messages from automation scripts." +msgstr "" + +msgid "Options" +msgstr "" + +msgid "" +"The locale module accepts the " +"following options:" +msgstr "" + +msgid "-h, --help" +msgstr "" + +msgid "--filter=\"REGEX\"" +msgstr "" + +msgid "" +"When “DIRECTORY” is passed as argument, this option reduces the " +"number of section blocks inside configuration files the locale module will take for processing " +"by using the “REGEX” value is a regular expression pattern to match " +"one or more section names inside the configuration files found " +"under “DIRECTORY”. When “FILE” is passed as argument, in the other " +"hand, it limits the number of files that will be set in the list of " +"source files used to build the final translation files." +msgstr "" + +msgid "--update" +msgstr "" + +msgid "--edit" +msgstr "" + +msgid "--delete" +msgstr "" + +msgid "Localizing Image Files" +msgstr "" + +#, no-wrap +msgid "" +"\n" +"Hi\n" +"\n" +"Localizing Documentation Files" +msgstr "" + +msgid "Hi" +msgstr "" + +msgid "Localizing Automation Scripts" +msgstr "" + +msgid "Author" +msgstr "" + +msgid "" +"Written by Alain Reguera " +"Delgado" +msgstr "" + +msgid "Copyright" +msgstr "" + +msgid "Copyright © 2009-2013 The CentOS Project" +msgstr "" + +msgid "" +"This program is free software; you can redistribute it and/or " +"modify it under the terms of the GNU General Public License as " +"published by the Free Software Foundation; either version 2 of the " +"License, or (at your option) any later version." +msgstr "" + +msgid "" +"This program is distributed in the hope that it will be useful, but " +"WITHOUT ANY WARRANTY; without even the implied warranty of " +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU " +"General Public License for more details." +msgstr "" + +msgid "" +"You should have received a copy of the GNU General Public License " +"along with this program; if not, write to the Free Software " +"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." +msgstr "" + +msgid "See Also" +msgstr "" + +msgid "centos-art.sh(1), centos-art.sh-render(1), gettext(1)" +msgstr "" + +#. Put one translator per line, in the form of NAME , YEAR1, YEAR2. +msgid "translator-credits" +msgstr "" diff --git a/Automation/Modules/Locale/Manuals/locale.conf.sh.asciidoc b/Automation/Modules/Locale/Manuals/locale.conf.sh.asciidoc deleted file mode 100644 index 815b507..0000000 --- a/Automation/Modules/Locale/Manuals/locale.conf.sh.asciidoc +++ /dev/null @@ -1,70 +0,0 @@ -locale.conf.sh(1) -================= - -Name ----- - -locale.conf.sh - Initialize environment variables for locale module. - -Synopsis --------- - -*declare* [*-xr*] _NAME_[=_VALUE_] ... - -Options -------- - -*-r*:: - Make _NAME_ read-only. These names cannot then be assigned values - by subsequent assignment statements or unset. -*-x*:: - Mark _NAME_ for export to subsequent commands via the environment. - -Variables ---------- - -The *locale.conf.sh* file contains the following environment -variables: - -_MODULE_VERSION_:: - Specifies the module's version. This variable is read-only. -_ACTIONS_:: - Specifies the command-line actions. This variable is used to - gather the list of action-related options passed to locale module - through the command-line. -TCAR_SCRIPT_MODULES_BASEDIR:: - Specifies the locale modules' base directory. This is the - directory where the first level locale modules are stored in. You - must set this variable to ``${MODULE_DIR_MODULES}'' if you want to - use locale modules. - -Author ------- - -Written by mailto:al@centos.org.cu[Alain Reguera Delgado] - -Copyright ---------- - -Copyright (C) 2009-2013 The CentOS Project - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at -your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -See Also --------- - -bash(1) - -// vim: set syntax=asciidoc: diff --git a/Automation/Modules/Locale/Manuals/locale.sh.asciidoc b/Automation/Modules/Locale/Manuals/locale.sh.asciidoc deleted file mode 100644 index 0dc5770..0000000 --- a/Automation/Modules/Locale/Manuals/locale.sh.asciidoc +++ /dev/null @@ -1,70 +0,0 @@ -locale.sh(1) -============ - -Name ----- - -locale.sh - The locale module's initialization script. - -Synopsis --------- - ----------------------------------------------------------------------- -centos-art.sh locale ... -`-- tcar_setModuleEnvironment - `-- locale ----------------------------------------------------------------------- - -Description ------------ - -When the first argument passed to *centos-art.sh* script is the word -*locale*, the *centos-art.sh* script initializes the *locale* module -by loading the *locale.sh* file into its execution environment. The -*locale.sh* file's main purpose is to: - -1. Interpret arguments and options passed through command-line using - the _locale_getOptions_ procedure. - -2. Redefine positional parameters using ARGUMENTS local variable. At - this point, option arguments have been removed from TCAR_ARGUMENTS - variable and only non-option arguments remain in it. - -3. Verify the current locale information to avoid English messages - from being localized to themselves. The English language is used as - reference to write translatable strings inside the source files. - -4. Process arguments passed to locale module, based on whether they - are files or directories. - -Author ------- - -Written by mailto:al@centos.org.cu[Alain Reguera Delgado] - -Copyright ---------- - -Copyright (C) 2009-2013 The CentOS Project - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at -your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -See Also --------- - -centos-art.sh-locale(1), locale.conf.sh(1) - - -// vim: set syntax=asciidoc: diff --git a/Automation/Modules/Locale/Manuals/render.conf b/Automation/Modules/Locale/Manuals/render.conf index 337300c..c2fcded 100644 --- a/Automation/Modules/Locale/Manuals/render.conf +++ b/Automation/Modules/Locale/Manuals/render.conf @@ -1,8 +1,3 @@ -# -# This configuration files contains the information the render module -# needs to produce the asciidoc documentation in both manpage and -# xhtml format. -# [centos-art.sh-locale] render-type = "asciidoc" render-flow = "manpage" @@ -10,23 +5,3 @@ render-from = "centos-art.sh-locale.asciidoc" locale-from = "${TCAR_SCRIPT_LANG_LC}/centos-art.sh-locale.asciidoc.po" formats = "xhtml manpage" mansect = "1" - -# -# Add manpages for all scripts, as well. -# - -[locale.conf.sh] -render-type = "asciidoc" -render-flow = "manpage" -render-from = "locale.conf.sh.asciidoc" -locale-from = "${TCAR_SCRIPT_LANG_LC}/locale.conf.sh.asciidoc.po" -formats = "manpage" -mansect = "1" - -[locale.sh] -render-type = "asciidoc" -render-flow = "manpage" -render-from = "locale.sh.asciidoc" -locale-from = "${TCAR_SCRIPT_LANG_LC}/locale.sh.asciidoc.po" -formats = "manpage" -mansect = "1" diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh deleted file mode 100755 index 17a178f..0000000 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh +++ /dev/null @@ -1,27 +0,0 @@ -###################################################################### -# -# update.conf.sh -- This file defines environment variables used by -# update module's execution environment. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh index eb9d2ce..a14b1de 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh @@ -27,6 +27,6 @@ function update { - tcar_setModuleEnvironment "${RENDER_TYPE}" "${@}" + tcar_setSubModuleEnvironment "${RENDER_TYPE}" "${@}" } diff --git a/Automation/Modules/Locale/Modules/Actions/actions.conf.sh b/Automation/Modules/Locale/Modules/Actions/actions.conf.sh deleted file mode 100755 index 74b79b6..0000000 --- a/Automation/Modules/Locale/Modules/Actions/actions.conf.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -###################################################################### -# -# actions.conf.sh -- This file defines environment variables used by -# actions module's execution environment. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} diff --git a/Automation/Modules/Locale/Modules/Actions/actions.sh b/Automation/Modules/Locale/Modules/Actions/actions.sh index 8376f3e..430beec 100755 --- a/Automation/Modules/Locale/Modules/Actions/actions.sh +++ b/Automation/Modules/Locale/Modules/Actions/actions.sh @@ -27,10 +27,8 @@ function actions { - local ACTION='' - - for ACTION in ${ACTIONS};do - tcar_setModuleEnvironment "${ACTION}" "${@}" + for SUBMODULE in ${SUBMODULES};do + tcar_setSubModuleEnvironment "${SUBMODULE}" "${@}" done } diff --git a/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh b/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh index 49a2d58..a0a1b5e 100755 --- a/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh +++ b/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh @@ -91,7 +91,7 @@ function directory_getConfiguration { PO_FILE=${TRANSLATIONS[0]} # Initialize locale's actions module. - tcar_setModuleEnvironment "actions" "${@}" + tcar_setSubModuleEnvironment "actions" "${@}" # Increment section's counter. COUNTER=$(( ${COUNTER} + 1 )) diff --git a/Automation/Modules/Locale/Modules/File/file.sh b/Automation/Modules/Locale/Modules/File/file.sh index 740d5a9..55f8ff5 100755 --- a/Automation/Modules/Locale/Modules/File/file.sh +++ b/Automation/Modules/Locale/Modules/File/file.sh @@ -71,6 +71,6 @@ function file { done # Process configuration variables through locale's actions module. - tcar_setModuleEnvironment "actions" "${@}" + tcar_setSubModuleEnvironment "actions" "${@}" } diff --git a/Automation/Modules/Locale/locale.conf.sh b/Automation/Modules/Locale/locale.conf.sh deleted file mode 100755 index 5e24bef..0000000 --- a/Automation/Modules/Locale/locale.conf.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -###################################################################### -# -# locale.conf.sh -- This file defines environment variables used by -# locale module's execution environment. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2009-2013 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -###################################################################### - -declare -xr MODULE_VERSION='0.1' -declare -x ACTIONS='' -declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} diff --git a/Automation/Modules/Locale/locale.sh b/Automation/Modules/Locale/locale.sh index a5720ae..5a77cec 100755 --- a/Automation/Modules/Locale/locale.sh +++ b/Automation/Modules/Locale/locale.sh @@ -27,23 +27,39 @@ function locale { + local SUBMODULES='' + + # Interpret arguments and options passed through command-line. locale_getOptions "${@}" + # Redefine positional parameters using ARGUMENTS local variable. + # At this point, option arguments have been removed from + # TCAR_ARGUMENTS variable and only non-option arguments remain in + # it. eval set -- "${TCAR_ARGUMENTS}" + # Verify the current locale information to avoid English messages + # from being localized to themselves. The English language is used + # as reference to write translatable strings inside the source + # files. if [[ ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then tcar_printMessage "`gettext "The English language cannot be localized to itself."`" --as-error-line fi + # Process arguments passed to locale module, based on whether they + # are files or directories. for ARGUMENT in ${@};do - ARGUMENT=$(tcar_checkRepoDirSource "${ARGUMENT}") + + local ARGUMENT=$(tcar_checkRepoDirSource "${ARGUMENT}") + if [[ -f ${ARGUMENT} ]];then - tcar_setModuleEnvironment "file" "${@}" + tcar_setSubModuleEnvironment "file" "${@}" elif [[ -d ${ARGUMENT} ]];then - tcar_setModuleEnvironment "directory" "${@}" + tcar_setSubModuleEnvironment "directory" "${@}" else tcar_printMessage "`gettext "The argument provided isn't valid."`" --as-error-line fi + done } diff --git a/Automation/Modules/Locale/locale_getOptions.sh b/Automation/Modules/Locale/locale_getOptions.sh index 0648bf2..08f970e 100755 --- a/Automation/Modules/Locale/locale_getOptions.sh +++ b/Automation/Modules/Locale/locale_getOptions.sh @@ -59,17 +59,17 @@ function locale_getOptions { ;; --update ) - ACTIONS="${ACTIONS} update" + SUBMODULES="${SUBMODULES} update" shift 1 ;; --edit ) - ACTIONS="${ACTIONS} edit" + SUBMODULES="${SUBMODULES} edit" shift 1 ;; --delete ) - ACTIONS="${ACTIONS} delete" + SUBMODULES="${SUBMODULES} delete" shift 1 ;; @@ -80,8 +80,8 @@ function locale_getOptions { esac done - if [[ -z ${ACTIONS} ]];then - ACTIONS='update' + if [[ -z ${SUBMODULES} ]];then + SUBMODULES='update' fi # Redefine arguments using current positional parameters. Only