| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function render_getActionsTranslations { |
| |
| |
| |
| |
| |
| |
| if [[ ! -d $ACTIONVAL/Tpl ]];then |
| cli_printMessage "`gettext "Can't find translation templates in the directory provided."`" |
| cli_printMessage "$(caller)" "AsToKnowMoreLine" |
| fi |
| |
| # Check if there are pre-defined configuration scripts for the |
| # current translation directory being processed. If you passed the |
| # previous checks, it is time to check if the directory you are |
| # processing already has render.conf.sh configuration scripts, |
| # inside its trunk/Scripts/Bash/Config/... asociated strucutre. If |
| # such directory entry exists, the translation rendering should |
| # end immediatly at this point because it is surely not a |
| # release-specific translation rendering. |
| if [[ -d $ARTCONF ]];then |
| for FILE in $(find $ARTCONF -name 'render.conf.sh');do |
| # Initialize configuration function. |
| . $FILE |
| # Execute configuration function |
| render_loadConfig |
| done |
| # At this point, an entry inside trunk/Scripts/Bash/Config/... |
| # was found for the directory being processed. If the |
| # render.conf.sh files were there, they were executed. Because |
| # render.conf.sh has to do with very specificy translation |
| # rendering features (e.g., brands translation rendering), |
| # that doesn't match release-specifc rendering translation |
| |
| |
| cli_printMessage "$(caller)" "AsToKnowMoreLine" |
| fi |
| |
| |
| |
| |
| |
| |
| local RELEASES='' |
| local MAJOR_RELEASE='' |
| local MINOR_RELEASE='' |
| local RELEASE_INFO='' |
| local LOCALES_INFO='' |
| local LOCALE='' |
| local TRANSLATION='' |
| local FILE='' |
| |
| |
| |
| |
| local MESSAGE="\ |
| # Warning: Do not modify this file directly. This file is created |
| # automatically using 'centos-art' command line interface. Any change |
| # you do in this file will be lost the next time you update |
| # translation files using 'centos-art' command line interface. If you |
| # want to improve the content of this translation file, improve its |
| # template file instead and run the 'centos-art' command line |
| # interface later to propagate your changes." |
| |
| |
| MESSAGE=$(echo "$MESSAGE" | sed 's!^[[:space:]]*!!') |
| |
| |
| |
| |
| |
| |
| if [[ $REGEX =~ "^${RELEASE_FORMAT}$" ]];then |
| RELEASES=$ACTIONVAL/$REGEX |
| |
| |
| |
| |
| |
| |
| elif [[ $REGEX =~ "^(${RELEASE_FORMAT},?)+" ]];then |
| for RELEASE in $(echo $REGEX | tr ',' ' ');do |
| RELEASES="$RELEASES $RELEASE" |
| done |
| |
| |
| |
| else |
| RELEASES=$(find $ACTIONVAL -regextype posix-egrep \ |
| -regex "^${ACTIONVAL}/${RELEASE_FORMAT}$" | sort) |
| fi |
| |
| |
| |
| |
| if [[ $RELEASES == "" ]];then |
| cli_printMessage "`gettext "There is not release-specific directory in the translation entry."`" |
| cli_printMessage "$(caller)" "AsToKnowMoreLine" |
| fi |
| |
| for RELEASE in $RELEASES;do |
| |
| |
| RELEASE=$(basename $RELEASE) |
| |
| |
| if [[ ! "$RELEASE" =~ "^${RELEASE_FORMAT}$" ]]; then |
| cli_printMessage "`eval_gettext "The \\\"\\\$RELEASE\\\" release number isn't valid."`" |
| cli_printMessage "$(caller)" "AsToKnowMoreLine" |
| fi |
| |
| # Define major and minor release format. |
| if [[ "$RELEASE" =~ '^[[:digit:]]+\.[[:digit:]]+$' ]]; then |
| MAJOR_RELEASE="$(echo $RELEASE | cut -d. -f1)" |
| MINOR_RELEASE="$(echo $RELEASE | cut -d. -f2)" |
| elif [[ "$RELEASE" =~ '^[[:digit:]]+$' ]]; then |
| MAJOR_RELEASE="$RELEASE" |
| MINOR_RELEASE='0' |
| fi |
| |
| # Define release translation markers. |
| RELEASE_INFO=" |
| |
| s!=RELEASE=!=MAJOR_RELEASE=.=MINOR_RELEASE=!g |
| s!=MINOR_RELEASE=!$MINOR_RELEASE!g |
| s!=MAJOR_RELEASE=!$MAJOR_RELEASE!g" |
| |
| # Strip opening spaces from release info output lines. |
| RELEASE_INFO=$(echo "$RELEASE_INFO" | sed 's!^[[:space:]]*!!') |
| |
| # Get translation templates and process them using release |
| # information previously defined. |
| for FILE in $(find $ACTIONVAL/Tpl -name '*.sed');do |
| |
| # Define translation file locale. |
| LOCALE=$(echo $FILE | sed -r 's!^/.+/Tpl/([a-z]{2}|[a-z]{2}_[A-Z]{2})/.+$!\1!' ) |
| if [[ $LOCALE =~ '^([a-z]{2}|[a-z]{2}_[A-Z]{2})$' ]];then |
| |
| # Define locales translation markers. |
| LOCALES_INFO=" |
| |
| s!=LOCALE=!${LOCALE}!g" |
| |
| # Strip opening spaces from locales translation markers |
| # output lines. |
| LOCALES_INFO=$(echo "$LOCALES_INFO" | sed 's!^[[:space:]]*!!') |
| |
| fi |
| |
| # Define absolute path to translation template file. |
| TRANSLATION=$FILE |
| |
| # Define absolute path to translation final file. |
| FILE=$(echo $FILE | sed "s!/Tpl!/$RELEASE!") |
| |
| # Create release-specific directory, if it doesn't exist. |
| DIRNAME=$(dirname $FILE) |
| if [[ ! -d $DIRNAME ]];then |
| mkdir -p $DIRNAME |
| fi |
| |
| # Output information about files being processed. |
| cli_printMessage $TRANSLATION "AsTranslationLine" |
| cli_printMessage $FILE "AsSavedAsLine" |
| |
| # Add warnning message to final translation file. |
| echo "$MESSAGE" > $FILE |
| |
| # Add template content to final translation file. |
| cat $TRANSLATION >> $FILE |
| |
| # Add release markers to final translation file. |
| echo "$RELEASE_INFO" >> $FILE |
| |
| # Add locales markers to final translation file, if they |
| # have locales information only. |
| if [[ $LOCALES_INFO != '' ]];then |
| echo "$LOCALES_INFO" >> $FILE |
| # Clean up locales information variable to receive |
| # next value. If we don't clean up the variable here, |
| # translation files without locale information (e.g., |
| # progress-first.sed, firstboot-left.sed, etc.) will |
| # use the locale information of the last translation |
| # template which does have locale information and we |
| # don't want that. We want to set locale information |
| # for each translation template individually. |
| LOCALES_INFO='' |
| fi |
| |
| echo "------------------------------------------------------------" |
| |
| done |
| |
| done \ |
| | awk -f /home/centos/artwork/trunk/Scripts/Bash/Styles/output_forTwoColumns.awk |
| } |
| |