|
|
4e4b4d |
#!/bin/bash
|
|
|
4e4b4d |
#
|
|
|
4e4b4d |
# locale_updateMessageMetadata.sh -- This function sanitates .pot and
|
|
|
4e4b4d |
# .po files to use common translation markers inside top comment.
|
|
|
4e4b4d |
# Later, replacement of common translation markers is applied to set
|
|
|
4e4b4d |
|
|
|
4e4b4d |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
4e4b4d |
|
|
|
4e4b4d |
# General Public License for more details.
|
|
|
4e4b4d |
#
|
|
|
4e4b4d |
|
|
|
4e4b4d |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
4e4b4d |
# ----------------------------------------------------------------------
|
|
|
80bc6f |
# $Id$
|
|
|
4e4b4d |
# ----------------------------------------------------------------------
|
|
|
4e4b4d |
|
|
|
4e4b4d |
function locale_updateMessageMetadata {
|
|
|
4e4b4d |
|
|
|
4e4b4d |
local COUNT=0
|
|
|
4e4b4d |
local -a SRC
|
|
|
4e4b4d |
local -a DST
|
|
|
4e4b4d |
|
|
|
4e4b4d |
|
|
|
4e4b4d |
local FILE="$1"
|
|
|
4e4b4d |
|
|
|
4e4b4d |
|
|
|
4e4b4d |
local CURRENTLOCALE=$(cli_getCurrentLocale)
|
|
|
4e4b4d |
|
|
|
4e4b4d |
|
|
|
4e4b4d |
local LANGNAME=$(cli_getLangName ${CURRENTLOCALE})
|
|
|
4e4b4d |
|
|
|
4e4b4d |
|
|
|
6042f8 |
cli_checkFiles "${FILE}"
|
|
|
4e4b4d |
|
|
|
bf6bff |
|
|
|
bec0a3 |
|
|
|
d421d4 |
SRC[0]="\"Project-Id-Version:"
|
|
|
d421d4 |
SRC[1]="\"Report-Msgid-Bugs-To:"
|
|
|
d421d4 |
SRC[2]="\"Last-Translator:"
|
|
|
d421d4 |
SRC[3]="\"Language-Team:"
|
|
|
4e4b4d |
|
|
|
bf6bff |
# Define replacement lines for pattern line.
|
|
|
7b46a4 |
DST[0]="\"Project-Id-Version: ${CLI_PROGRAM} (${CURRENTLOCALE})\\\n\""
|
|
|
80bc6f |
DST[1]="\"Report-Msgid-Bugs-To: The CentOS L10n SIG <=MAIL_L10N=>\\\n\""
|
|
|
80bc6f |
DST[2]="\"Last-Translator: The CentOS L10n SIG <=MAIL_L10N=>\\\n\""
|
|
|
bec0a3 |
DST[3]="\"Language-Team: ${LANGNAME}\\\n\""
|
|
|
4e4b4d |
|
|
|
bec0a3 |
# Change pattern lines with their replacement lines.
|
|
|
4e4b4d |
while [[ $COUNT -lt ${#SRC[*]} ]];do
|
|
|
4e4b4d |
sed -i -r "/${SRC[$COUNT]}/c${DST[$COUNT]}" ${FILE}
|
|
|
4e4b4d |
COUNT=$(($COUNT + 1))
|
|
|
4e4b4d |
done
|
|
|
4e4b4d |
|
|
|
988694 |
|
|
|
988694 |
|
|
|
988694 |
|
|
|
988694 |
# field in all .pot files, verify its existence and add it if it
|
|
|
988694 |
|
|
|
988694 |
egrep "^\"${SRC[1]}" $FILE > /dev/null
|
|
|
988694 |
if [[ $? -ne 0 ]];then
|
|
|
988694 |
sed -i -r "/^\"${SRC[0]}/a${DST[1]}" $FILE
|
|
|
988694 |
fi
|
|
|
988694 |
|
|
|
bec0a3 |
|
|
|
bec0a3 |
sed -i -r "s/PACKAGE/${TEXTDOMAIN}/g" ${FILE}
|
|
|
bec0a3 |
|
|
|
988694 |
|
|
|
54cb18 |
cli_expandTMarkers ${FILE}
|
|
|
988694 |
|
|
|
4e4b4d |
|
|
|
4e4b4d |
unset SRC
|
|
|
4e4b4d |
unset DST
|
|
|
4e4b4d |
|
|
|
4e4b4d |
}
|