|
|
57da3b |
#!/bin/bash
|
|
|
57da3b |
#
|
|
|
57da3b |
# render_doTranslation.sh -- This function standardizes the way
|
|
|
57da3b |
# translation files are applied to design models in order to produce
|
|
|
57da3b |
# the translated instance that is used to expand translation markers
|
|
|
57da3b |
# and produce the base-rendition output.
|
|
|
57da3b |
#
|
|
|
57da3b |
# Assuming no translation file exists, the an untranslated instace
|
|
|
57da3b |
# from the design model is created (i.e., just a copy of it). Using a
|
|
|
57da3b |
# design model instance (translated or not) is required in order to
|
|
|
57da3b |
# expand translation markers safetly.
|
|
|
57da3b |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
57da3b |
#
|
|
|
57da3b |
# This program is free software; you can redistribute it and/or modify
|
|
|
57da3b |
# it under the terms of the GNU General Public License as published by
|
|
|
57da3b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
57da3b |
# your option) any later version.
|
|
|
57da3b |
#
|
|
|
57da3b |
# This program is distributed in the hope that it will be useful, but
|
|
|
57da3b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
57da3b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
57da3b |
# General Public License for more details.
|
|
|
57da3b |
#
|
|
|
57da3b |
# You should have received a copy of the GNU General Public License
|
|
|
57da3b |
# along with this program; if not, write to the Free Software
|
|
|
57da3b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
57da3b |
#
|
|
|
57da3b |
# ----------------------------------------------------------------------
|
|
|
57da3b |
# $Id$
|
|
|
57da3b |
# ----------------------------------------------------------------------
|
|
|
57da3b |
|
|
|
57da3b |
function render_doTranslation {
|
|
|
57da3b |
|
|
|
57da3b |
# Verify translation file existence and create template
|
|
|
57da3b |
# instance accordingly.
|
|
|
57da3b |
if [[ -f ${TRANSLATION} ]];then
|
|
|
57da3b |
|
|
|
57da3b |
# Create translated instance from design model.
|
|
|
57da3b |
/usr/bin/xml2po -a -p ${TRANSLATION} ${TEMPLATE} > ${INSTANCE}
|
|
|
57da3b |
|
|
|
57da3b |
# Remove .xml2po.mo temporal file.
|
|
|
57da3b |
if [[ -f ${PWD}/.xml2po.mo ]];then
|
|
|
57da3b |
rm ${PWD}/.xml2po.mo
|
|
|
57da3b |
fi
|
|
|
57da3b |
|
|
|
57da3b |
else
|
|
|
57da3b |
|
|
|
57da3b |
# Create non-translated instance form design model.
|
|
|
57da3b |
/bin/cp ${TEMPLATE} ${INSTANCE}
|
|
|
57da3b |
|
|
|
57da3b |
fi
|
|
|
57da3b |
|
|
|
57da3b |
}
|