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

814e83
#!/bin/bash
814e83
#
814e83
# locale_updateMessageXmlDocbookNoEntities.sh -- This function creates
814e83
# an instance of one or more Docbook files without expanding entities
814e83
# inside it, retrieves all translatable strings from main file
814e83
# instance, and creates the related portable object template POT for
814e83
# them. This is useful to localize Docbook files that aren't direct
814e83
# part of a documentation manual but included at rendition time (e.g.,
814e83
# Docbook files holding license information).
814e83
#
814e83
# Copyright (C) 2009-2013 The CentOS Project
814e83
#
814e83
# This program is free software; you can redistribute it and/or modify
814e83
# it under the terms of the GNU General Public License as published by
814e83
# the Free Software Foundation; either version 2 of the License, or (at
814e83
# your option) any later version.
814e83
#
814e83
# This program is distributed in the hope that it will be useful, but
814e83
# WITHOUT ANY WARRANTY; without even the implied warranty of
814e83
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
814e83
# General Public License for more details.
814e83
#
814e83
# You should have received a copy of the GNU General Public License
814e83
# along with this program; if not, write to the Free Software
814e83
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
814e83
#
814e83
# ----------------------------------------------------------------------
814e83
# $Id$
814e83
# ----------------------------------------------------------------------
814e83
814e83
function locale_updateMessageXmlDocbookNoEntities {
814e83
814e83
    # In case no path to Docbook main file is not found, go deeper
814e83
    # into the documentation models directory structure looking for
814e83
    # files that do match the name of the directory who hold it, and
814e83
    # use that file as template to initiate localization process. The
814e83
    # way to reach these files have to be through --filter options
814e83
    # because we want to respect the restrictions imposed by
814e83
    # locale_isLocalizable function inside the repository.
814e83
    # CAUTION: entity expansion the files found this way will be # ignored.
814e83
    local TEMPLATES=$(cli_getFilesList ${ACTIONVAL} --type='f' \
814e83
        --pattern=".+/${FLAG_FILTER}.+\.${EXTENSION}$")
814e83
814e83
    # Verify number of template files found and define what kind of
814e83
    # processing they are going to have. In case more than one
814e83
    # template file be found and because entity expansion will be
814e83
    # ignored in such case, the whole process of creating the PO file
814e83
    # for all these templates is also different (simpler) from that we
814e83
    # use with entity expansion.
814e83
814e83
    for TEMPLATE in ${TEMPLATES};do
814e83
814e83
        # Redefine path related to localization work directory.
814e83
        local L10N_WORKDIR=$(cli_getLocalizationDir "$TEMPLATE")
814e83
814e83
        # Define location of the file used to create both portable
814e83
        # object templates (.pot) and portable objects (.po) files.
814e83
        local MESSAGES="${L10N_WORKDIR}/messages"
814e83
814e83
        # Print action message.
814e83
        cli_printMessage "${MESSAGES}.pot" --as-updating-line
814e83
814e83
        # Extract translatable strings from docbook files and merge
814e83
        # them down into related messages file.
814e83
        xml2po -a -l ${CLI_LANG_LL} -o ${MESSAGES}.pot ${TEMPLATE} 
814e83
814e83
        # Verify, initialize or merge portable objects from portable
814e83
        # object templates.
814e83
        locale_updateMessagePObjects "${MESSAGES}"
814e83
814e83
    done
814e83
814e83
}