|
|
4e4b4d |
#!/bin/bash
|
|
|
4e4b4d |
#
|
|
|
0d4faa |
# locale_updateMessageXml.sh -- This function parses XML-based files
|
|
|
0d4faa |
# (e.g., scalable vector graphics), retrives translatable strings and
|
|
|
f4bdfd |
# creates/update gettext portable objects.
|
|
|
4e4b4d |
#
|
|
|
2d3646 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
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_updateMessageXml {
|
|
|
4e4b4d |
|
|
|
fef984 |
# Print separator line.
|
|
|
510fad |
cli_printMessage '-' --as-separator-line
|
|
|
fef984 |
|
|
|
fef984 |
# Initialize local variables.
|
|
|
f4bdfd |
local FILE=''
|
|
|
f4bdfd |
local FILES=''
|
|
|
4e4b4d |
|
|
|
f4bdfd |
# Define filename used to create both portable object templates
|
|
|
f4bdfd |
# (.pot) and portable objects (.po) files.
|
|
|
17e33e |
FILE="${WORKDIR}/messages"
|
|
|
f4bdfd |
|
|
|
053779 |
# Define regular expression to match extensions of XML files we
|
|
|
053779 |
# use inside the repository.
|
|
|
6ca4b0 |
local EXTENSION='(svg|xml|xhtml|docbook)'
|
|
|
053779 |
|
|
|
649cc5 |
# Build list of files to process.
|
|
|
053779 |
if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/(Models|Manual|Themes/Models)/.+$" ]];then
|
|
|
1c3966 |
FILES=$(cli_getFilesList "$ACTIONVAL" "${FLAG_FILTER}.*\.${EXTENSION}")
|
|
|
bf6bff |
else
|
|
|
510fad |
cli_printMessage "`gettext "The path provided cannot be processed."`" --as-error-line
|
|
|
bf6bff |
fi
|
|
|
0d4faa |
|
|
|
4e4b4d |
# Print action message.
|
|
|
510fad |
cli_printMessage "${FILE}.pot" --as-updating-line
|
|
|
4e4b4d |
|
|
|
fb5554 |
# Prepare directory structure to receive .po files.
|
|
|
fb5554 |
if [[ ! -d $(dirname ${FILE}) ]];then
|
|
|
fb5554 |
mkdir -p $(dirname ${FILE})
|
|
|
fb5554 |
fi
|
|
|
fb5554 |
|
|
|
4e4b4d |
# Retrive translatable strings from XML-based files and
|
|
|
f4bdfd |
# create the portable object template (.pot) from them.
|
|
|
fd54df |
/usr/bin/xml2po -a ${FILES} | msgcat --output=${FILE}.pot --width=70 --sort-by-file -
|
|
|
4e4b4d |
|
|
|
f4bdfd |
# Verify, initialize or merge portable objects from portable
|
|
|
f4bdfd |
# object templates.
|
|
|
f4bdfd |
locale_updateMessagePObjects "${FILE}"
|
|
|
4e4b4d |
|
|
|
4e4b4d |
}
|