From ed92ff69ce7929486b628708d65d3e0da3120d72 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Dec 28 2013 01:49:37 +0000 Subject: Reset value of TEXTDOMAIN locally to common functions. - Previously, common functions didn't reset the TEXTDOMAIN environment variable. This made gettext to read the MO file set in the last TEXTDOMAIN definition which may not include the translated strings for the function in turn. This update changes the common functions that make calls to gettext in order to reset the value of TEXTDOMAIN environment variable locally to the appropriate package. Because the TEXTDOMAIN variable is reset locally to common functions, the value it has on higher scopes isn't affected by this local reset. This way, it is possible to separate localization of modules from localization of common functions. --- diff --git a/tcar-scripts/tcar_checkFiles.sh b/tcar-scripts/tcar_checkFiles.sh index 7f18ee8..5a16a64 100755 --- a/tcar-scripts/tcar_checkFiles.sh +++ b/tcar-scripts/tcar_checkFiles.sh @@ -32,6 +32,11 @@ function tcar_checkFiles { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + # Initialize local array variables. local -a CONDITION_COMMAND local -a CONDITION_PATTERN diff --git a/tcar-scripts/tcar_getTemporalFile.sh b/tcar-scripts/tcar_getTemporalFile.sh index 498bfa9..7a7e61b 100755 --- a/tcar-scripts/tcar_getTemporalFile.sh +++ b/tcar-scripts/tcar_getTemporalFile.sh @@ -29,6 +29,11 @@ function tcar_getTemporalFile { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + # Define base name for temporal file. This is required when svg # instances are created previous to be parsed by inkscape in order # to be exported as png. In such cases .svg file extension is diff --git a/tcar-scripts/tcar_printCopyrightInfo.sh b/tcar-scripts/tcar_printCopyrightInfo.sh index 2779fd8..a5f8d58 100755 --- a/tcar-scripts/tcar_printCopyrightInfo.sh +++ b/tcar-scripts/tcar_printCopyrightInfo.sh @@ -39,6 +39,11 @@ function tcar_printCopyrightInfo { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + case "${1}" in --license ) @@ -99,18 +104,18 @@ function tcar_printCopyrightInfo { # Print tcar.sh script default copyright holder. Be # pragmatic about this information, please. The CentOS # Project exists to produce The CentOS Distribution, not - # tcar.sh script. Nevertheless, The CentOS Artwork - # SIG is an organizational unit of The CentOS Project - # which is focused on producing The CentOS Project - # corporate visual identity, by means of The CentOS - # Artwork Repository. The tcar.sh script automates - # frequent tasks inside The CentOS Artwork Repository so, - # based on these considerations, the copyright holder of - # the tcar.sh script is "closer" to be The CentOS - # Artwork SIG than it would be The CentOS Project. These - # are the logical choosing ideas behind the copyright - # holder of tcar.sh script. - echo "The CentOS Artwork SIG" + # tcar.sh script. Nevertheless, The CentOS Artwork SIG is + # an organizational unit of The CentOS Project which is + # focused on producing The CentOS Project corporate visual + # identity, by means of The CentOS Artwork Repository. + # The tcar.sh script automates frequent tasks inside The + # CentOS Artwork Repository so, based on these + # considerations, the copyright holder of the tcar.sh + # script is "closer" to be The CentOS Artwork SIG than it + # would be The CentOS Project. These are the logical + # choosing ideas behind the copyright holder of tcar.sh + # script. + echo "`gettext "The CentOS Artwork SIG"`" ;; --holder-predicate ) diff --git a/tcar-scripts/tcar_printMessage.sh b/tcar-scripts/tcar_printMessage.sh index 9b11543..cc1b324 100755 --- a/tcar-scripts/tcar_printMessage.sh +++ b/tcar-scripts/tcar_printMessage.sh @@ -27,6 +27,11 @@ function tcar_printMessage { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + local MESSAGE="${1}" local FORMAT="${2}" diff --git a/tcar-scripts/tcar_printVersion.sh b/tcar-scripts/tcar_printVersion.sh index 794259a..efebabc 100755 --- a/tcar-scripts/tcar_printVersion.sh +++ b/tcar-scripts/tcar_printVersion.sh @@ -27,6 +27,11 @@ function tcar_printVersion { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + local PROGRAM_NAME=${1:-${TCAR_SCRIPT_PACKAGE}} local YEAR=$(tcar_printCopyrightInfo --year) local HOLDER=$(tcar_printCopyrightInfo --holder) diff --git a/tcar-scripts/tcar_setModuleArguments.sh b/tcar-scripts/tcar_setModuleArguments.sh index 9f3118a..5d32e96 100755 --- a/tcar-scripts/tcar_setModuleArguments.sh +++ b/tcar-scripts/tcar_setModuleArguments.sh @@ -45,6 +45,11 @@ function tcar_setModuleArguments { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + # Verify non-option arguments passed to command-line. If there # isn't any or dot is provided, redefine the TCAR_MODULE_ARGUMENT # variable to use the current location the tcar.sh script diff --git a/tcar-scripts/tcar_setModuleEnvironmentScripts.sh b/tcar-scripts/tcar_setModuleEnvironmentScripts.sh index bd9df2f..5d81439 100755 --- a/tcar-scripts/tcar_setModuleEnvironmentScripts.sh +++ b/tcar-scripts/tcar_setModuleEnvironmentScripts.sh @@ -28,6 +28,11 @@ function tcar_setModuleEnvironmentScripts { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + # Define the pattern used to retrieve function names from function # files. local FUNCTION_PATTERN="^function[[:space:]]+${TCAR_MODULE_NAME}(_[[:alnum:]]+)?[[:space:]]+{[[:space:]]*$" diff --git a/tcar-scripts/tcar_unsetModuleEnvironment.sh b/tcar-scripts/tcar_unsetModuleEnvironment.sh index 73db8c2..188edaa 100755 --- a/tcar-scripts/tcar_unsetModuleEnvironment.sh +++ b/tcar-scripts/tcar_unsetModuleEnvironment.sh @@ -27,6 +27,11 @@ function tcar_unsetModuleEnvironment { + # Reset text domain locally, in order to prevent this function + # from using the last text domain definition. By default all + # common functions do use the same MO file. + local TEXTDOMAIN="${TCAR_SCRIPT_PACKAGE}" + # Verify suffix value used to retrieve function files. if [[ -z ${TCAR_MODULE_NAME} ]];then tcar_printMessage "`gettext "The export id was not provided."`" --as-error-line