Blame tcar-scripts-locale/Modules/Files/Modules/Update/update_convertXmlToPot.sh

Alain Reguera Delgado f72cfe
#!/bin/bash
Alain Reguera Delgado f72cfe
######################################################################
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
#   update_convertXmlToPot.sh -- This function takes an XML file and
Alain Reguera Delgado f72cfe
#   creates a portable object template (.pot) for it.
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
#   Written by:
Alain Reguera Delgado f72cfe
#   * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
# Copyright (C) 2009-2013 The CentOS Artwork SIG
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado f72cfe
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado f72cfe
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado f72cfe
# your option) any later version.
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado f72cfe
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado f72cfe
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado f72cfe
# General Public License for more details.
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado f72cfe
# along with this program; if not, write to the Free Software
Alain Reguera Delgado f72cfe
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado f72cfe
#
Alain Reguera Delgado f72cfe
######################################################################
Alain Reguera Delgado f72cfe
Alain Reguera Delgado f72cfe
function update_convertXmlToPot {
Alain Reguera Delgado f72cfe
Alain Reguera Delgado f72cfe
    local XML_FILE=${1}
Alain Reguera Delgado f72cfe
    local POT_FILE=${2}
Alain Reguera Delgado f72cfe
Alain Reguera Delgado f72cfe
    # Move to final location before processing source file in order
Alain Reguera Delgado f72cfe
    # for relative calls (e.g., image files) inside the source files
Alain Reguera Delgado f72cfe
    # can be found by xml2po and no warning be printed from it.
Alain Reguera Delgado f72cfe
    if [[ -d ${RENDER_TARGET} ]];then
Alain Reguera Delgado f72cfe
        pushd ${RENDER_TARGET} > /dev/null
Alain Reguera Delgado f72cfe
    fi
Alain Reguera Delgado f72cfe
Alain Reguera Delgado f72cfe
    cat ${XML_FILE} | xml2po -a -l ${TCAR_SCRIPT_LANG_LC} - \
Alain Reguera Delgado f72cfe
        | msgcat --output-file=${POT_FILE} --width=70 --no-location -
Alain Reguera Delgado f72cfe
Alain Reguera Delgado f72cfe
    if [[ -d ${RENDER_TARGET} ]];then
Alain Reguera Delgado f72cfe
        popd > /dev/null
Alain Reguera Delgado f72cfe
    fi
Alain Reguera Delgado f72cfe
}