From 2b2258e9fed747c0c69ce171a2477217eeecd2c0 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Oct 24 2013 06:21:36 +0000 Subject: Update render module of centos-art.sh script. - Previously, render module was using the TARGET variable name to store the final location where files will be stored in. This update change the variable name from TARGET to RENDER_TARGET to make it clear it refers to render module. - Add missing tcar_checkRepoDirSources verification when assigning positional parameters. - Previously, when producing content through extended rendition, final files in English language are stored inside the Images directory and files in non-English languages are stored inside a language-specific directory inside the Images directory. This update uses the Final/${TCAR_SCRIPT_LANG_LC} directory structure for final files in both English and non-English languages. - Add --no-locale-dir option. This option let you control whether final content is produced inside language-specific directories or not. By default final content is stored inside language-specific directories. - Previously, the render_setLocalizedXml function was using SOURCES name variable instead of SOURCE variable name. This made the whole localization process to fail because no file was found for processing. This update changes the render_setLocalizedXml function to use SOURCE variable name instead of SOURCES. - Previously, the render_setLocalizedXml function didn't verify existence of the translation files it works with. This update changes render_setLocalizedXml to verify existence of translation files before processing them. - Previously, the render_setLocalizedXml function moved into directory holding localization files at the exact time of producing the localized xml with the intention of finding the files relatively referred inside the xml file. However those files aren't stored in the localziation directory but inside the final render location. This update changes the render_setLocalizedXml function to move into final render location instead of localization location. --- diff --git a/Automation/Modules/Render/Modules/Directories/directories.sh b/Automation/Modules/Render/Modules/Directories/directories.sh index 95ef77d..8f132c9 100755 --- a/Automation/Modules/Render/Modules/Directories/directories.sh +++ b/Automation/Modules/Render/Modules/Directories/directories.sh @@ -28,7 +28,7 @@ function directories { - local DIRECTORY="${1}" + local DIRECTORY=$(tcar_checkRepoDirSource "${1}") local CONFIGURATION_FILES=$(tcar_getFilesList ${DIRECTORY} \ --pattern=".+/.+\.conf$" --type='f') @@ -43,7 +43,7 @@ function directories { # when no file is found). tcar_checkFiles -e "${CONFIGURATIONS}" - # Process each configuration file. + # Process configuration file, one by one. for CONFIGURATION in ${CONFIGURATIONS};do tcar_setModuleEnvironment -m 'files' -t 'sibling' -g "${CONFIGURATION}" done diff --git a/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh b/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh index f84125c..b020f93 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Archive/archive.sh @@ -27,7 +27,7 @@ function archive { - tcar_printMessage "${TARGET}" --as-creating-line + tcar_printMessage "${RENDER_TARGET}" --as-creating-line COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") if [[ -z ${COMMAND} ]];then @@ -44,7 +44,7 @@ function archive { pushd ${TCAR_SCRIPT_TEMPDIR} > /dev/null - ${COMMAND} ${TARGET} * + ${COMMAND} ${RENDER_TARGET} * popd > /dev/null diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh index bb2b4c7..518a649 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/Modules/Manpage/manpage.sh @@ -13,12 +13,12 @@ function manpage { case ${FORMAT} in 'xhtml' ) - local HTML_TARGET="$(dirname ${TARGET})/htmlman${MANSECT}/$(basename ${TARGET}).${MANSECT}.html" + local HTML_TARGET="$(dirname ${RENDER_TARGET})/htmlman${MANSECT}/$(basename ${RENDER_TARGET}).${MANSECT}.html" asciidoc_setXhtmlRendition "${HTML_TARGET}" ;; 'manpage' ) - local MAN_TARGET="$(dirname ${TARGET})/man${MANSECT}/$(basename ${TARGET}).${MANSECT}" + local MAN_TARGET="$(dirname ${RENDER_TARGET})/man${MANSECT}/$(basename ${RENDER_TARGET}).${MANSECT}" if [[ ! -d $(dirname ${MAN_TARGET}) ]];then mkdir -p $(dirname ${MAN_TARGET}) fi diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh index e7a8126..76fc85c 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc.sh @@ -43,12 +43,6 @@ function asciidoc { FORMATS='xhtml' fi - local -a SOURCE_INSTANCES - local -a TARGET_INSTANCES - asciidoc_setBaseRendition - unset SOURCE_INSTANCES - unset TARGET_INSTANCES - } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh index bc72693..f060b6e 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRendition.sh @@ -28,6 +28,8 @@ function asciidoc_setBaseRendition { + local -a SOURCE_INSTANCES + local -a TARGET_INSTANCES local COUNTER=0 while [[ ${COUNTER} -lt ${#SOURCES[*]} ]];do @@ -72,4 +74,7 @@ function asciidoc_setBaseRendition { tcar_setModuleEnvironment -m "${RENDER_FLOW}" -t "child" done + unset SOURCE_INSTANCES + unset TARGET_INSTANCES + } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh index f61d112..4e4d410 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setBaseRenditionCommand.sh @@ -30,6 +30,7 @@ function asciidoc_setBaseRenditionCommand { tcar_checkFiles -m '^(article|book|manpage)$' ${RENDER_TYPE} - asciidoc --backend docbook --doctype ${RENDER_TYPE} -o ${TARGET} + asciidoc --backend='docbook' --doctype="${RENDER_TYPE}" \ + --out-file="${RENDER_TARGET}" } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh index 240dfc1..fc37e09 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setFormatsRendition.sh @@ -6,7 +6,7 @@ function asciidoc_setFormatsRendition { case ${FORMAT} in 'xhtml' ) - asciidoc_setXhtmlRendition "${TARGET}" + asciidoc_setXhtmlRendition "${RENDER_TARGET}" ;; esac diff --git a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh index 8b47790..9c78593 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Asciidoc/asciidoc_setXhtmlRendition.sh @@ -2,7 +2,7 @@ function asciidoc_setXhtmlRendition { - local TARGET="${1}" + local LOCATION=$(tcar_checkRepoDirSource "${1}") RENDER_PAGES=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "render-page") if [[ -z ${RENDER_PAGES} ]];then @@ -28,20 +28,20 @@ function asciidoc_setXhtmlRendition { # files, produce both chunks and single XHTML output in the same # directory. if [[ ${RENDER_PAGES} == 'chunks' ]];then - TARGET="$(dirname ${TARGET})/" + LOCATION="$(dirname ${LOCATION})/" fi - if [[ ! -d $(dirname ${TARGET}) ]];then - mkdir -p $(dirname ${TARGET}) + if [[ ! -d $(dirname ${LOCATION}) ]];then + mkdir -p $(dirname ${LOCATION}) fi - ln -sfn ${IMAGES_FROM} $(dirname ${TARGET})/Images - ln -sfn ${STYLES_FROM} $(dirname ${TARGET})/Css + ln -sfn ${IMAGES_FROM} $(dirname ${LOCATION})/Images + ln -sfn ${STYLES_FROM} $(dirname ${LOCATION})/Css - tcar_printMessage "${TARGET}" --as-creating-line + tcar_printMessage "${LOCATION}" --as-creating-line for RENDER_PAGE in ${RENDER_PAGES};do - /usr/bin/xsltproc -o ${TARGET} --nonet \ + /usr/bin/xsltproc -o ${LOCATION} --nonet \ ${DOCBOOK_XSL}/docbook2xhtml-${RENDER_PAGE}.xsl ${DOCBOOK_FILE} done diff --git a/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh b/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh index d355d81..8ef514f 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Compress/compress.sh @@ -27,7 +27,7 @@ function compress { - tcar_printMessage "${TARGET}" --as-creating-line + tcar_printMessage "${RENDER_TARGET}" --as-creating-line COMMAND=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "command") if [[ -z ${COMMAND} ]];then diff --git a/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh b/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh index 2ef06cd..0dd0712 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Images/images.sh @@ -38,12 +38,12 @@ function images { COMMAND="/usr/bin/images -append" fi - if [[ ! -d $(dirname ${TARGET}) ]];then - mkdir -p $(dirname ${TARGET}) + if [[ ! -d $(dirname ${RENDER_TARGET}) ]];then + mkdir -p $(dirname ${RENDER_TARGET}) fi - tcar_printMessage "${TARGET}" --as-creating-line + tcar_printMessage "${RENDER_TARGET}" --as-creating-line - eval ${COMMAND} ${SOURCES[*]} ${TARGET} + eval ${COMMAND} ${SOURCES[*]} ${RENDER_TARGET} } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh index 49a6c65..68a1640 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Palette/palette.sh @@ -31,7 +31,7 @@ function palette { local FILENAME=$(tcar_getTemporalFile "$(echo ${SOURCES[0]} \ | sed -r 's/\.[[:alpha:]]+$//')") - local LOGS=${TARGET}.log + local LOGS=${RENDER_TARGET}.log # Define absolute path to GPL palette. This file is the reference # taken to set the max number of colors the final image will be @@ -67,9 +67,9 @@ function palette { < ${FILENAME}.pnm 2>>${LOGS} > ${FILENAME}.ppm # Print action message. - tcar_printMessage "${TARGET}" --as-creating-line + tcar_printMessage "${RENDER_TARGET}" --as-creating-line - if [[ ${TARGET} =~ '\.lss$' ]];then + if [[ ${RENDER_TARGET} =~ '\.lss$' ]];then # Define the HEX palette. The HEX palette is built from source # palette (PALETTE_GPL) and provides the color information in @@ -85,19 +85,19 @@ function palette { # Create LSS16 image. ppmtolss16 $(cat ${PALETTE_HEX}) \ - < ${FILENAME}.ppm 2>>${LOGS} > ${TARGET} + < ${FILENAME}.ppm 2>>${LOGS} > ${RENDER_TARGET} # Create PPM image indexed to 16 colors. Also the colormap # used in the LSS16 image is saved on ${FILE}.log; this is # useful to verify the correct order of colors in the image # index. lss16toppm -map \ - < ${TARGET} 2>>${LOGS} > ${TARGET}.ppm + < ${RENDER_TARGET} 2>>${LOGS} > ${RENDER_TARGET}.ppm else # Create final file. - /usr/bin/convert ${FILENAME}.ppm ${TARGET} + /usr/bin/convert ${FILENAME}.ppm ${RENDER_TARGET} fi diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh index f292935..b6cc8cb 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/Modules/Extended/extended_setBaseRendition.sh @@ -1,9 +1,9 @@ #!/bin/bash ###################################################################### # -# Modules/Render/Modules/Svg/Modules/Extended/Scripts/extended_setBaseRendition.sh -# -- This function standardize base rendition tasks needed to -# perform the extended production of PNG files from SVG files. +# extended_setBaseRendition.sh -- This function standardize base +# rendition tasks needed to perform the extended production of PNG +# files from SVG files. # # Written by: # * Alain Reguera Delgado , 2009-2013 @@ -28,17 +28,11 @@ function extended_setBaseRendition { - # Redefine absolute path to final file. - local TARGET=$(dirname ${CONFIGURATION})/Images/${FGCOLOR}/${BGCOLOR}/${HEIGHT}/${SECTION} - if [[ ! ${TCAR_SCRIPT_LANG_LL} =~ '^en$' ]];then - TARGET=$(dirname ${CONFIGURATION})/${TCAR_SCRIPTS_LANG_LC}/Images/${FGCOLOR}/${BGCOLOR}/${HEIGHT}/${SECTION} - fi - svg_setBaseRendition # Create path for different image formats creation using PNG image # extension as reference. - local TARGET=$(echo ${TARGET} | sed -r "s/\.png$//") + local RENDER_TARGET=$(echo ${RENDER_TARGET} | sed -r "s/\.png$//") # Convert images from PNG to those formats specified in the # configuration file. @@ -46,8 +40,8 @@ function extended_setBaseRendition { if [[ ${FORMAT} =~ 'png' ]];then continue fi - tcar_printMessage "${TARGET}.${FORMAT}" --as-creating-line - convert ${TARGET}.png ${TARGET}.${FORMAT} + tcar_printMessage "${RENDER_TARGET}.${FORMAT}" --as-creating-line + convert ${RENDER_TARGET}.png ${RENDER_TARGET}.${FORMAT} done } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh index 2fbc7e2..6f28110 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBaseRendition.sh @@ -32,8 +32,6 @@ function svg_setBaseRendition { local -a SOURCE_INSTANCES local -a TARGET_INSTANCES - local -a TARGET_COMMANDS - local -a INKSCAPE_OPTIONS while [[ ${COUNTER} -lt ${#SOURCES[*]} ]];do @@ -75,15 +73,15 @@ function svg_setBaseRendition { done # Verify existence of output directory. - if [[ ! -d $(dirname ${TARGET}) ]];then - mkdir -p $(dirname ${TARGET}) + if [[ ! -d $(dirname ${RENDER_TARGET}) ]];then + mkdir -p $(dirname ${RENDER_TARGET}) fi - tcar_printMessage "${TARGET}" --as-creating-line + tcar_printMessage "${RENDER_TARGET}" --as-creating-line # Apply command to PNG images produced from design models to # construct the final PNG image. - ${COMMAND} ${TARGET_INSTANCES[*]} ${TARGET} + ${COMMAND} ${TARGET_INSTANCES[*]} ${RENDER_TARGET} # Apply branding images to final PNG image. if [[ -n ${BRANDS} ]];then @@ -92,7 +90,7 @@ function svg_setBaseRendition { # Apply comment to final PNG image. if [[ -n ${COMMENT} ]];then - /usr/bin/mogrify -comment "${COMMENT}" ${TARGET} + /usr/bin/mogrify -comment "${COMMENT}" ${RENDER_TARGET} fi # Remove instances to save disk space. There is no need to have @@ -107,8 +105,6 @@ function svg_setBaseRendition { # concatenations. unset SOURCE_INSTANCES unset TARGET_INSTANCES - unset TARGET_COMMANDS - unset INKSCAPE_OPTIONS unset COUNTER } diff --git a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh index f635678..637ad7b 100755 --- a/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh +++ b/Automation/Modules/Render/Modules/Files/Modules/Svg/svg_setBrandInformation.sh @@ -35,7 +35,7 @@ function svg_setBrandInformation { tcar_checkFiles -ef ${FILENAME} - /usr/bin/composite -geometry ${GEOMETRY} ${FILENAME} ${TARGET} ${TARGET} + /usr/bin/composite -geometry ${GEOMETRY} ${FILENAME} ${RENDER_TARGET} ${RENDER_TARGET} done diff --git a/Automation/Modules/Render/Modules/Files/files.sh b/Automation/Modules/Render/Modules/Files/files.sh index d9ad5f2..9ef4071 100755 --- a/Automation/Modules/Render/Modules/Files/files.sh +++ b/Automation/Modules/Render/Modules/Files/files.sh @@ -28,7 +28,7 @@ function files { - local CONFIGURATION="${1}" + local CONFIGURATION=$(tcar_checkRepoDirSource "${1}") local -a SECTIONS local SECTION='' @@ -68,12 +68,12 @@ function files { SECTION=${SECTIONS[${COUNTER}]} if [[ ${SECTION} =~ "^/" ]];then - TARGET=${SECTION} + RENDER_TARGET=${SECTION} else - if [[ ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then - TARGET=$(dirname ${CONFIGURATION})/${SECTION} + if [[ ${RENDER_NO_LOCALE_DIR} == 'true' ]];then + RENDER_TARGET=$(dirname ${CONFIGURATION})/Final/${SECTION} else - TARGET=$(dirname ${CONFIGURATION})/${TCAR_SCRIPT_LANG_LC}/${SECTION} + RENDER_TARGET=$(dirname ${CONFIGURATION})/Final/${TCAR_SCRIPT_LANG_LC}/${SECTION} fi fi @@ -101,40 +101,15 @@ function files { LOCALE_FROM=$(tcar_getConfigValue "${CONFIGURATION}" "${SECTION}" "locale-from") - # When the current locale information is not English, don't - # process section blocks unless they have any related - # translation file. There is no need to have untranslated - # content inside language-specific directories. - if [[ ! ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then - - if [[ -z ${LOCALE_FROM} ]];then - - # Increment array counter. - COUNTER=$(( ${COUNTER} + 1 )) - - # Reset array variable to avoid undesired - # concatenations between sections blocks. - unset TRANSLATIONS - unset SOURCES - - # Move to next section block. - continue - + for TRANSLATION in ${LOCALE_FROM};do + if [[ ${TRANSLATION} =~ "^/" ]];then + TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=${TRANSLATION} + else + TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=$(dirname ${CONFIGURATION})/${TRANSLATION} fi + done - for TRANSLATION in ${LOCALE_FROM};do - if [[ ${TRANSLATION} =~ "^/" ]];then - TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=${TRANSLATION} - else - TRANSLATIONS[((++${#TRANSLATIONS[*]}))]=$(dirname ${CONFIGURATION})/${TRANSLATION} - fi - done - - tcar_checkFiles -ef ${TRANSLATIONS[*]} - - fi - - # Initialize render's modules. + # Execute module for processing type-specific files. tcar_setModuleEnvironment -m "${RENDER_TYPE}" -t "child" # Increment section's counter. diff --git a/Automation/Modules/Render/render.sh b/Automation/Modules/Render/render.sh index 2cdc589..ddedb2d 100755 --- a/Automation/Modules/Render/render.sh +++ b/Automation/Modules/Render/render.sh @@ -27,6 +27,10 @@ function render { + # Define flag to control whether final content is produced inside + # locale directories or not. + RENDER_NO_LOCALE_DIR='false' + # Interpret arguments and options passed through command-line. render_getOptions diff --git a/Automation/Modules/Render/render_getOptions.sh b/Automation/Modules/Render/render_getOptions.sh index 40fb2cb..1879429 100755 --- a/Automation/Modules/Render/render_getOptions.sh +++ b/Automation/Modules/Render/render_getOptions.sh @@ -31,7 +31,7 @@ function render_getOptions { local ARGSS="h::,v,f:" # Define long options we want to support. - local ARGSL="help::,version,filter:" + local ARGSL="help::,version,filter:,no-locale-dir" # Redefine arguments using getopt(1) command parser. tcar_setModuleArguments @@ -57,6 +57,11 @@ function render_getOptions { shift 2 ;; + --no-locale-dir ) + RENDER_NO_LOCALE_DIR='true' + shift 1 + ;; + -- ) # Remove the `--' argument from the list of arguments # in order for processing non-option arguments diff --git a/Automation/Modules/Render/render_setLocalizedXml.sh b/Automation/Modules/Render/render_setLocalizedXml.sh index ecaa0fe..dd087a9 100755 --- a/Automation/Modules/Render/render_setLocalizedXml.sh +++ b/Automation/Modules/Render/render_setLocalizedXml.sh @@ -41,27 +41,30 @@ function render_setLocalizedXml { # content. This is required because template files might be found # as compressed files inside the repository. local COMMAND="/bin/cat" - if [[ $(file -b -i ${SOURCES}) =~ '^application/x-gzip$' ]];then + if [[ $(/usr/bin/file -b -i ${SOURCE}) =~ '^application/x-gzip$' ]];then COMMAND="/bin/zcat" fi - if [[ -f ${TRANSLATIONS[0]} ]];then + local TRANSLATION=$(tcar_getTemporalFile "messages.po") - # Define name of temporal file used as translation instance. - local TRANSLATION_INSTANCE=${TCAR_SCRIPT_TEMPDIR}/messages.po + if [[ ${#TRANSLATIONS[*]} -gt 0 ]];then - # Combine translations into the translation instance. - msgcat -u -o ${TRANSLATION_INSTANCE} ${TRANSLATIONS[*]} + # Verify existence of translation files. + tcar_checkFiles -efi 'text/x-po' ${TRANSLATIONS[*]} - # Move to translation's directory before processing source - # file in order for relative calls (e.g., image files) inside - # the source files can be found by xml2po and no warning be + # Combine available translations file into one translation + # instance. + msgcat -u -o ${TRANSLATION} ${TRANSLATIONS[*]} + + # Move to final location before processing source file in + # order for relative calls (e.g., image files) inside the + # source files can be found by xml2po and no warning be # printed from it. - pushd $(dirname ${TRANSLATIONS[0]}) > /dev/null + pushd $(dirname ${RENDER_TARGET}) > /dev/null # Create the translated instance of design model. ${COMMAND} ${SOURCE} | xml2po -a -l ${TCAR_SCRIPT_LANG_LC} \ - -p ${TRANSLATION_INSTANCE} -o ${TARGET} - + -p ${TRANSLATION} -o ${TARGET} - # Remove .xml2po.mo temporal file. if [[ -f ./.xml2po.mo ]];then @@ -73,8 +76,8 @@ function render_setLocalizedXml { # Remove instance created to store both licenses and template # translations. - if [[ -f ${TRANSLATION_INSTANCE} ]];then - rm ${TRANSLATION_INSTANCE} + if [[ -f ${TRANSLATION} ]];then + rm ${TRANSLATION} fi # xml2po bug? For some reason, xml2po is not adding the lang @@ -87,7 +90,9 @@ function render_setLocalizedXml { fi else + ${COMMAND} ${SOURCE} > ${TARGET} + fi }