|
|
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 |
#
|
|
|
4e4b4d |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
4e4b4d |
#
|
|
|
4e4b4d |
# This program is free software; you can redistribute it and/or
|
|
|
4e4b4d |
# modify it under the terms of the GNU General Public License as
|
|
|
4e4b4d |
# published by the Free Software Foundation; either version 2 of the
|
|
|
4e4b4d |
# License, or (at your option) any later version.
|
|
|
4e4b4d |
#
|
|
|
4e4b4d |
# This program is distributed in the hope that it will be useful, but
|
|
|
4e4b4d |
# 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
|
|
|
4e4b4d |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4e4b4d |
# USA.
|
|
|
4e4b4d |
#
|
|
|
4e4b4d |
# ----------------------------------------------------------------------
|
|
|
4e4b4d |
# $Id$
|
|
|
4e4b4d |
# ----------------------------------------------------------------------
|
|
|
4e4b4d |
|
|
|
4e4b4d |
function locale_updateMessageXml {
|
|
|
4e4b4d |
|
|
|
f4bdfd |
local FILE=''
|
|
|
f4bdfd |
local FILES=''
|
|
|
4e4b4d |
|
|
|
f4bdfd |
# Define filename used to create both portable object templates
|
|
|
f4bdfd |
# (.pot) and portable objects (.po) files.
|
|
|
f4bdfd |
FILE="${WORKDIR}/$(cli_getCurrentLocale)"
|
|
|
f4bdfd |
|
|
|
f4bdfd |
# Redefine filter flag to specify the extension of files the
|
|
|
f4bdfd |
# translatable messages are retrived from and so limiting the
|
|
|
f4bdfd |
# list of files to process to the number of files we want to
|
|
|
f4bdfd |
# retrive translatable messages from. Use action value as
|
|
|
f4bdfd |
# reference to find out different shell files.
|
|
|
f4bdfd |
if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/.+" ]];then
|
|
|
f4bdfd |
FLAG_FILTER=".*${FLAG_FILTER}.*\.svg"
|
|
|
f4bdfd |
elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Manuals/.+" ]];then
|
|
|
f4bdfd |
FLAG_FILTER=".*${FLAG_FILTER}.*\.xml"
|
|
|
bf6bff |
else
|
|
|
f4bdfd |
cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine'
|
|
|
f4bdfd |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
bf6bff |
fi
|
|
|
0d4faa |
|
|
|
f4bdfd |
# Build list of files to process.
|
|
|
0d4faa |
cli_getFilesList
|
|
|
4e4b4d |
|
|
|
0d4faa |
# Print action preamble.
|
|
|
4e4b4d |
cli_printActionPreamble "${FILES}" "doLocale" 'AsResponseLine'
|
|
|
4e4b4d |
|
|
|
4e4b4d |
# Print action message.
|
|
|
4e4b4d |
cli_printMessage "${FILE}.pot" 'AsUpdatingLine'
|
|
|
4e4b4d |
|
|
|
4e4b4d |
# Retrive translatable strings from XML-based files and
|
|
|
f4bdfd |
# create the portable object template (.pot) from them.
|
|
|
f4bdfd |
/usr/bin/xml2po ${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 |
}
|