|
|
dbd41f |
#!/bin/bash
|
|
|
dbd41f |
#
|
|
|
dbd41f |
# locale_updateMessagePObjects.sh --- This function verifies,
|
|
|
dbd41f |
# initializes or updates portable objects from portable object
|
|
|
dbd41f |
# templates.
|
|
|
dbd41f |
#
|
|
|
dbd41f |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
dbd41f |
#
|
|
|
dbd41f |
# This program is free software; you can redistribute it and/or
|
|
|
dbd41f |
# modify it under the terms of the GNU General Public License as
|
|
|
dbd41f |
# published by the Free Software Foundation; either version 2 of the
|
|
|
dbd41f |
# License, or (at your option) any later version.
|
|
|
dbd41f |
#
|
|
|
dbd41f |
# This program is distributed in the hope that it will be useful, but
|
|
|
dbd41f |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
dbd41f |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
dbd41f |
# General Public License for more details.
|
|
|
dbd41f |
#
|
|
|
dbd41f |
# You should have received a copy of the GNU General Public License
|
|
|
dbd41f |
# along with this program; if not, write to the Free Software
|
|
|
dbd41f |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
dbd41f |
# USA.
|
|
|
dbd41f |
#
|
|
|
dbd41f |
# ----------------------------------------------------------------------
|
|
|
dbd41f |
# $Id$
|
|
|
dbd41f |
# ----------------------------------------------------------------------
|
|
|
dbd41f |
|
|
|
dbd41f |
function locale_updateMessagePObjects {
|
|
|
dbd41f |
|
|
|
dbd41f |
local FILE="$1"
|
|
|
dbd41f |
|
|
|
dbd41f |
# Verify the portable object template. The portable object
|
|
|
dbd41f |
# template is used to create the portable object.
|
|
|
fb5554 |
cli_checkFiles "${FILE}.pot" 'f'
|
|
|
dbd41f |
|
|
|
dbd41f |
# Verify existence of portable object. The portable object is the
|
|
|
dbd41f |
# file translators edit in order to make translation works.
|
|
|
dbd41f |
if [[ -f ${FILE}.po ]];then
|
|
|
dbd41f |
|
|
|
dbd41f |
# Print action message.
|
|
|
dbd41f |
cli_printMessage "${FILE}.po" 'AsUpdatingLine'
|
|
|
dbd41f |
|
|
|
dbd41f |
# Update portable object merging both portable object and
|
|
|
dbd41f |
# portable object template.
|
|
|
dbd41f |
msgmerge --output="${FILE}.po" "${FILE}.po" "${FILE}.pot" --quiet
|
|
|
dbd41f |
|
|
|
dbd41f |
else
|
|
|
dbd41f |
|
|
|
3f6c79 |
# Print action message.
|
|
|
3f6c79 |
cli_printMessage "${FILE}.po" 'AsCreatingLine'
|
|
|
3f6c79 |
|
|
|
3f6c79 |
# Initiate portable object using portable object template.
|
|
|
3f6c79 |
# Do not print msginit sterr output, use centos-art action
|
|
|
3f6c79 |
# message instead.
|
|
|
3f6c79 |
msginit -i ${FILE}.pot -o ${FILE}.po --width=70 \
|
|
|
3f6c79 |
--no-translator 2> /dev/null
|
|
|
dbd41f |
|
|
|
dbd41f |
# Sanitate portable object metadata. This is the first time
|
|
|
dbd41f |
# the portable object is created so some modifications are
|
|
|
dbd41f |
# needed to customized metadata.
|
|
|
dbd41f |
locale_updateMessageMetadata "${FILE}.po"
|
|
|
dbd41f |
|
|
|
dbd41f |
fi
|
|
|
dbd41f |
|
|
|
dbd41f |
}
|