|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# locale_updateMessageMetadata.sh -- This function sanitates .pot and
|
|
|
878a2b |
# .po files to use common translation markers inside top comment.
|
|
|
878a2b |
# Later, replacement of common translation markers is applied to set
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function locale_updateMessageMetadata {
|
|
|
878a2b |
|
|
|
878a2b |
local COUNT=0
|
|
|
878a2b |
local -a SRC
|
|
|
878a2b |
local -a DST
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local FILE="$1"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
8ee532 |
cli_checkFiles -e "${FILE}"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
add5ea |
|
|
|
add5ea |
|
|
|
add5ea |
|
|
|
add5ea |
|
|
|
add5ea |
|
|
|
878a2b |
SRC[0]="\"Project-Id-Version:"
|
|
|
878a2b |
SRC[1]="\"Report-Msgid-Bugs-To:"
|
|
|
add5ea |
SRC[2]="\"Last-Translator: (Documentation SIG)?"
|
|
|
878a2b |
SRC[3]="\"Language-Team:"
|
|
|
878a2b |
SRC[4]="\"PO-Revision-Date:"
|
|
|
878a2b |
|
|
|
878a2b |
# Define replacement lines for pattern line.
|
|
|
fde49a |
DST[0]="\"Project-Id-Version: ${CLI_NAME}-${CLI_VERSION}\\\n\""
|
|
|
c72f40 |
DST[1]="\"Report-Msgid-Bugs-To: Documentation SIG <$(cli_printMailingList --docs)>\\\n\""
|
|
|
5c0ed3 |
DST[2]="\"Last-Translator: Documentation SIG\\\n\""
|
|
|
8ee532 |
DST[3]="\"Language-Team: $(locale_getLanguageName)\\\n\""
|
|
|
878a2b |
DST[4]="\"PO-Revision-Date: $(date "+%F %H:%M%z")\\\n\""
|
|
|
878a2b |
|
|
|
878a2b |
# Change pattern lines with their replacement lines.
|
|
|
878a2b |
while [[ $COUNT -lt ${#SRC[*]} ]];do
|
|
|
878a2b |
sed -i -r "/${SRC[$COUNT]}/c${DST[$COUNT]}" ${FILE}
|
|
|
878a2b |
COUNT=$(($COUNT + 1))
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# field in all .pot files, verify its existence and add it if it
|
|
|
878a2b |
|
|
|
878a2b |
egrep "^\"${SRC[1]}" $FILE > /dev/null
|
|
|
878a2b |
if [[ $? -ne 0 ]];then
|
|
|
878a2b |
sed -i -r "/^\"${SRC[0]}/a${DST[1]}" $FILE
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
fde49a |
sed -i -r "s/PACKAGE/${CLI_NAME}-${CLI_VERSION}/g" ${FILE}
|
|
|
878a2b |
|
|
|
5c0ed3 |
|
|
|
5c0ed3 |
|
|
|
5c0ed3 |
|
|
|
5c0ed3 |
|
|
|
5c0ed3 |
|
|
|
5c0ed3 |
|
|
|
5c0ed3 |
sed -i -r "s,${TCAR_WORKDIR}/,,g" ${FILE}
|
|
|
5c0ed3 |
|
|
|
878a2b |
|
|
|
878a2b |
cli_expandTMarkers ${FILE}
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
unset SRC
|
|
|
878a2b |
unset DST
|
|
|
878a2b |
|
|
|
878a2b |
}
|