Blame Scripts/Bash/Functions/Render/render_doTranslationMarkers.sh

7ac81d
#!/bin/bash
7ac81d
#
7ac81d
# render_doTranslationMarkers.sh -- This function standardizes
7ac81d
# replacements for common translation markers.  This function must be
7ac81d
# called from render_getIdentityDefs.sh function (after instance
7ac81d
# creation and before final file creation).  Raplacements are applied
7ac81d
# to temporal instances used to produced the final file.
7ac81d
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
7ac81d
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
7ac81d
# 
7ac81d
# This program is distributed in the hope that it will be useful, but
7ac81d
# WITHOUT ANY WARRANTY; without even the implied warranty of
7ac81d
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7ac81d
# General Public License for more details.
7ac81d
#
7ac81d
# You should have received a copy of the GNU General Public License
7ac81d
# along with this program; if not, write to the Free Software
7ac81d
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
7ac81d
# USA.
7ac81d
# 
7ac81d
# ----------------------------------------------------------------------
7ac81d
# $Id$
7ac81d
# ----------------------------------------------------------------------
7ac81d
7ac81d
function render_doTranslationMarkers {
7ac81d
220ca9
    # Initialize theme replacements.
220ca9
    local -a SRC
220ca9
    local -a DST
220ca9
    local COUNT=0
220ca9
220ca9
    # Redefine theme translation markers.
220ca9
    SRC[0]='=THEME='
220ca9
    SRC[1]='=COPYRIGHT='
220ca9
    SRC[2]='=DESCRIPTION='
220ca9
    SRC[3]='=LICENSE='
220ca9
    SRC[4]='=NAME='
220ca9
    SRC[5]='=RELEASE='
4aa7ef
    SRC[6]='=URL='
220ca9
220ca9
    # Redefine theme replacements.
220ca9
    DST[0]="$(cli_getThemeName)"
5d1b71
    DST[1]="$(cli_getCopyrightInfo '--copyright')"
5d1b71
    DST[2]="$(cli_getCopyrightInfo '--description')"
5d1b71
    DST[3]="$(cli_getCopyrightInfo '--license')"
220ca9
    DST[4]="$(cli_getThemeName '--name')"
220ca9
    DST[5]="$(cli_getThemeName '--release')"
4aa7ef
    DST[6]="http://www.centos.org/"
220ca9
220ca9
    # Replace translation markes with theme values.
220ca9
    while [[ ${COUNT} -lt ${#SRC[*]} ]];do
5d1b71
5d1b71
        # Replace translation markers.
220ca9
        sed -r -i "s!${SRC[$COUNT]}!${DST[$COUNT]}!g" $INSTANCE
5d1b71
5d1b71
        # Increment counter.
220ca9
        COUNT=$(($COUNT + 1))
5d1b71
220ca9
    done
7ac81d
7ac81d
}