|
|
d1d5a8 |
#!/bin/bash
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# locale_updateMessageShell.sh -- This function parses shell scripts
|
|
|
d1d5a8 |
# under action value, retrives translatable strings and
|
|
|
d1d5a8 |
# creates/updates both portable object templates (.pot) and portable
|
|
|
bf6bff |
# objects (.po).
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# This program is free software; you can redistribute it and/or
|
|
|
d1d5a8 |
# modify it under the terms of the GNU General Public License as
|
|
|
d1d5a8 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
d1d5a8 |
# License, or (at your option) any later version.
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# This program is distributed in the hope that it will be useful, but
|
|
|
d1d5a8 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d1d5a8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
d1d5a8 |
# General Public License for more details.
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# You should have received a copy of the GNU General Public License
|
|
|
d1d5a8 |
# along with this program; if not, write to the Free Software
|
|
|
d1d5a8 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
d1d5a8 |
# USA.
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# ----------------------------------------------------------------------
|
|
|
d1d5a8 |
# $Id$
|
|
|
d1d5a8 |
# ----------------------------------------------------------------------
|
|
|
d1d5a8 |
|
|
|
d1d5a8 |
function locale_updateMessageShell {
|
|
|
d1d5a8 |
|
|
|
d241e1 |
local FILE=''
|
|
|
d241e1 |
local FILES=''
|
|
|
d1d5a8 |
|
|
|
d241e1 |
# Define file name used as reference to create portable object
|
|
|
bf6bff |
# templates (.pot), portable objects (.po) and machine objects
|
|
|
bf6bff |
# (.mo).
|
|
|
d241e1 |
FILE="${WORKDIR}/$(cli_getCurrentLocale)/${TEXTDOMAIN}"
|
|
|
d241e1 |
|
|
|
d241e1 |
# Verify directory used to store locale-specific translation
|
|
|
d241e1 |
# messages. If it doesn't exist, create it.
|
|
|
d241e1 |
if [[ ! -d $(dirname ${FILE}) ]];then
|
|
|
d241e1 |
mkdir -p $(dirname ${FILE})
|
|
|
d241e1 |
fi
|
|
|
d1d5a8 |
|
|
|
649cc5 |
# Build list of files to process.
|
|
|
d241e1 |
if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Scripts/Bash" ]];then
|
|
|
649cc5 |
FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.sh")
|
|
|
bf6bff |
else
|
|
|
d241e1 |
cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine'
|
|
|
bf6bff |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
d1d5a8 |
fi
|
|
|
d1d5a8 |
|
|
|
649cc5 |
# Set action preamble.
|
|
|
d1d5a8 |
cli_printActionPreamble "${FILES}" "doLocale" 'AsResponseLine'
|
|
|
d1d5a8 |
|
|
|
d1d5a8 |
# Print action message.
|
|
|
d1d5a8 |
cli_printMessage "${FILE}.pot" 'AsUpdatingLine'
|
|
|
d1d5a8 |
|
|
|
d241e1 |
# Retrive translatable strings from shell script files and create
|
|
|
d241e1 |
# the portable object template (.pot) from them.
|
|
|
d1d5a8 |
/usr/bin/xgettext --output=${FILE}.pot \
|
|
|
d1d5a8 |
--copyright-holder="CentOS Documentation SIG" \
|
|
|
d1d5a8 |
--width=70 --sort-by-file ${FILES}
|
|
|
d1d5a8 |
|
|
|
d241e1 |
# Verify, initialize or update portable objects from portable
|
|
|
d241e1 |
# object templates.
|
|
|
d241e1 |
locale_updateMessagePObjects "${FILE}"
|
|
|
d1d5a8 |
|
|
|
d1d5a8 |
}
|