Blame Automation/Bash/Functions/Locale/locale_updateMessageXmlDocbook.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# locale_updateMessageXmlDocbook.sh -- This function retrieves
Alain Reguera Delgado 8f60cb
# translation messages from Docbook files and creates related portable
Alain Reguera Delgado 8f60cb
# object template for them.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8f60cb
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8f60cb
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8f60cb
# your option) any later version.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8f60cb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8f60cb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8f60cb
# General Public License for more details.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8f60cb
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 8f60cb
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
# $Id$
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
function locale_updateMessageXmlDocbook {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define location where translation files will be stored in.
Alain Reguera Delgado 8f60cb
    local L10N_WORKDIR=$(cli_getLocalizationDir ${ACTIONVAL})
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define regular expression to match extensions of shell scripts
Alain Reguera Delgado 8f60cb
    # we use inside the repository.
Alain Reguera Delgado 8f60cb
    local EXTENSION='docbook'
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define absolute paths to Docbook main file.
Alain Reguera Delgado 8f60cb
    local TEMPLATE=$(cli_getFilesList ${ACTIONVAL} \
Alain Reguera Delgado 8f60cb
        --maxdepth=1 --mindepth=1 --type='f' \
Alain Reguera Delgado 8f60cb
        --pattern=".+/$(cli_getRepoName ${ACTIONVAL} -f)\.${EXTENSION}$")
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Process Docbook template files based on whether it is empty or
Alain Reguera Delgado 8f60cb
    # not. When it is empty, it is because there is not a Docbook main
Alain Reguera Delgado 8f60cb
    # file in the location provided to centos-art.sh script
Alain Reguera Delgado 8f60cb
    # command-line. In this case, we try to create one POT file to all
Alain Reguera Delgado 8f60cb
    # docbook files inside the location provided but without expanding
Alain Reguera Delgado 8f60cb
    # entities. When Docbook template file is not empty, expand
Alain Reguera Delgado 8f60cb
    # entities and create the POT file from a Docbook main file
Alain Reguera Delgado 8f60cb
    # instance, with all entities expanded. 
Alain Reguera Delgado 8f60cb
    if [[ -z ${TEMPLATE} ]];then
Alain Reguera Delgado 8f60cb
        locale_updateMessageXmlDocbookNoEntities
Alain Reguera Delgado 8f60cb
    else
Alain Reguera Delgado 8f60cb
        locale_updateMessageXmlDocbookWithEntities
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}