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
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
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
80bc6f
    # Verify existence of localization working directory. We cannot
80bc6f
    # update translation files that don't exist.
80bc6f
    cli_checkFiles $WORKDIR
80bc6f
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.
e9205d
    if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/(Manuals|Identity/Models)/.*$" ]];then
0d4faa
80bc6f
        # Update translatable strings inside the portable object
80bc6f
        # template related to XML-based files (e.g., scalable vector
80bc6f
        # graphics).
5a5b08
        ${CLI_FUNCNAME}_updateMessageXml
0d4faa
43b42f
    elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Scripts$" ]];then
0d4faa
80bc6f
        # Update translatable strings inside the portable object
80bc6f
        # template related to shell scripts (e.g., the centos-art.sh
80bc6f
        # script).
5a5b08
        ${CLI_FUNCNAME}_updateMessageShell
0d4faa
4e4b4d
    else
80bc6f
510fad
        cli_printMessage "`gettext "The path provided does not support localization."`" --as-error-line
4e4b4d
4e4b4d
    fi
4e4b4d
4e4b4d
}