Blame Scripts/Bash/Functions/Locale/locale_updateMessages.sh

4e4b4d
#!/bin/bash
4e4b4d
#
bf6bff
# locale_updateMessages.sh -- This function extracts translatable
bf6bff
# strings from both XML-based files (using xml2po) and shell scripts
bf6bff
# (using xgettext). Translatable strings are initially stored in
bf6bff
# portable objects templates (.pot) which are later merged into
bf6bff
# portable objects (.po) in order to be optionally converted as
bf6bff
# machine objects (.mo).
4e4b4d
#
4e4b4d
# Copyright (C) 2009-2011 Alain Reguera Delgado
4e4b4d
# 
4e4b4d
# This program is free software; you can redistribute it and/or
4e4b4d
# modify it under the terms of the GNU General Public License as
4e4b4d
# published by the Free Software Foundation; either version 2 of the
4e4b4d
# License, or (at your option) any later version.
4e4b4d
# 
4e4b4d
# This program is distributed in the hope that it will be useful, but
4e4b4d
# WITHOUT ANY WARRANTY; without even the implied warranty of
4e4b4d
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4e4b4d
# General Public License for more details.
4e4b4d
#
4e4b4d
# You should have received a copy of the GNU General Public License
4e4b4d
# along with this program; if not, write to the Free Software
4e4b4d
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4e4b4d
# USA.
4e4b4d
# 
4e4b4d
# ----------------------------------------------------------------------
4e4b4d
# $Id$
4e4b4d
# ----------------------------------------------------------------------
4e4b4d
4e4b4d
function locale_updateMessages {
4e4b4d
4e4b4d
    local ACTIONNAM=''
4e4b4d
4e4b4d
    # Evaluate action value to determine whether to use xml2po to
4e4b4d
    # extract translatable strings from XML-based files or to use
4e4b4d
    # xgettext to extract translatable strings from shell script
4e4b4d
    # files.
bf6bff
    if [[ $WORKDIR =~ "^${BASEDIR}/(Identity|Manuals)/.+$" ]];then
0d4faa
4e4b4d
        # Update translatable strings inside portable object templates
4e4b4d
        # for XML-based files (e.g., scalable vector graphics).
4e4b4d
        ACTIONNAM="${FUNCNAM}_updateMessageXml" 
0d4faa
bf6bff
    elif [[ $WORKDIR =~ "^${BASEDIR}/Scripts/.+$" ]];then
0d4faa
4e4b4d
        # Update translatable strings inside portable object templates
4e4b4d
        # for shell scripts (e.g., centos-art.sh script).
4e4b4d
        ACTIONNAM="${FUNCNAM}_updateMessageShell"
0d4faa
4e4b4d
    else
0d4faa
4e4b4d
        cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine'
4e4b4d
        cli_printMessage "$(caller)" 'AsToKnowMoreLine'
0d4faa
4e4b4d
    fi
4e4b4d
4e4b4d
    # Execute action name.
4e4b4d
    if [[ $ACTIONNAM != '' ]];then
4e4b4d
        eval $ACTIONNAM
4e4b4d
    fi
4e4b4d
4e4b4d
}