Blame Scripts/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
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# 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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4e4b4d
# ----------------------------------------------------------------------
4e4b4d
# $Id$
4e4b4d
# ----------------------------------------------------------------------
4e4b4d
4e4b4d
function locale_updateMessages {
4e4b4d
4e4b4d
    local ACTIONNAM=''
4e4b4d
43b42f
    # 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.
4f0e80
    if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/(Manual|Identity/Models)/.*$" ]];then
0d4faa
4e4b4d
        # Update translatable strings inside portable object templates
4e4b4d
        # for XML-based files (e.g., scalable vector graphics).
3cdabe
        ACTIONNAM="${FUNCNAM}_updateMessageXml"
0d4faa
43b42f
    elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/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
510fad
        cli_printMessage "`gettext "The path provided does not support localization."`" --as-error-line
4e4b4d
    fi
4e4b4d
4e4b4d
    # Execute action name.
3cdabe
    if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then
4e4b4d
        eval $ACTIONNAM
3cdabe
    else
510fad
        cli_printMessage "`gettext "A valid action is required."`" --as-error-line
4e4b4d
    fi
4e4b4d
4e4b4d
}