|
|
ce40cb |
#!/bin/bash
|
|
|
ce40cb |
#
|
|
|
79e54d |
# cli_replaceTMarkers.sh -- This function standardizes
|
|
|
ce40cb |
# replacements for common translation markers. Raplacements are
|
|
|
ce40cb |
|
|
|
ce40cb |
#
|
|
|
ce40cb |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
ce40cb |
|
|
|
ce40cb |
# General Public License for more details.
|
|
|
ce40cb |
#
|
|
|
ce40cb |
|
|
|
ce40cb |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
ce40cb |
# ----------------------------------------------------------------------
|
|
|
ce40cb |
# $Id$
|
|
|
ce40cb |
# ----------------------------------------------------------------------
|
|
|
ce40cb |
|
|
|
79e54d |
function cli_replaceTMarkers {
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
local -a SRC
|
|
|
ce40cb |
local -a DST
|
|
|
ce40cb |
local COUNT=0
|
|
|
9b4d7d |
local COUNTSRC=0
|
|
|
9b4d7d |
local COUNTDST=0
|
|
|
28f865 |
local LOCATION=''
|
|
|
28f865 |
|
|
|
35950d |
|
|
|
35950d |
LOCATION="$1"
|
|
|
28f865 |
|
|
|
35950d |
|
|
|
28f865 |
cli_checkFiles "$LOCATION" 'f'
|
|
|
ce40cb |
|
|
|
567435 |
|
|
|
567435 |
|
|
|
567435 |
|
|
|
567435 |
|
|
|
567435 |
|
|
|
f3fcd3 |
SRC[0]='=COPYRIGHT_YEAR='
|
|
|
f3fcd3 |
SRC[1]='=COPYRIGHT_HOLDER='
|
|
|
567435 |
SRC[2]='=LICENSE='
|
|
|
9b4d7d |
SRC[3]='=LICENSE_URL='
|
|
|
9b4d7d |
SRC[4]='=THEME='
|
|
|
9b4d7d |
SRC[5]='=THEMENAME='
|
|
|
9b4d7d |
SRC[6]='=THEMERELEASE='
|
|
|
9b4d7d |
SRC[7]='=RELEASE='
|
|
|
9b4d7d |
SRC[8]='=MAJOR_RELEASE='
|
|
|
9b4d7d |
SRC[9]='=MINOR_RELEASE='
|
|
|
9b4d7d |
SRC[10]='=URL='
|
|
|
28f865 |
SRC[11]='=ARCH='
|
|
|
9b4d7d |
SRC[12]='=URL_WIKI='
|
|
|
9b4d7d |
SRC[13]='=URL_LISTS='
|
|
|
9b4d7d |
SRC[14]='=URL_FORUMS='
|
|
|
9b4d7d |
SRC[15]='=URL_MIRRORS='
|
|
|
9b4d7d |
SRC[16]='=URL_DOCS='
|
|
|
1cb9cb |
SRC[17]='=MAIL_DOCS='
|
|
|
f4f773 |
SRC[18]='=URL_LL='
|
|
|
f4f773 |
SRC[19]='=DOMAIN_LL='
|
|
|
f4f773 |
SRC[20]='=URL_IRC='
|
|
|
88f09f |
SRC[21]='=LOCALE_LL='
|
|
|
6e7d60 |
SRC[22]='=LOCALE='
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
f3fcd3 |
DST[0]="$(cli_getCopyrightInfo '--copyright-year')"
|
|
|
f3fcd3 |
DST[1]="$(cli_getCopyrightInfo '--copyright-holder')"
|
|
|
567435 |
DST[2]="$(cli_getCopyrightInfo '--license')"
|
|
|
9b4d7d |
DST[3]="$(cli_getCopyrightInfo '--license-url')"
|
|
|
f3fcd3 |
DST[4]="$(cli_getPathComponent "$OUTPUT" '--theme')"
|
|
|
f3fcd3 |
DST[5]="$(cli_getPathComponent "$OUTPUT" '--theme-name')"
|
|
|
f3fcd3 |
DST[6]="$(cli_getPathComponent "$OUTPUT" '--theme-release')"
|
|
|
49237e |
DST[7]="$(cli_getPathComponent "$FLAG_RELEASEVER" '--release')"
|
|
|
49237e |
DST[8]="$(cli_getPathComponent "$FLAG_RELEASEVER" '--release-major')"
|
|
|
49237e |
DST[9]="$(cli_getPathComponent "$FLAG_RELEASEVER" '--release-minor')"
|
|
|
f4f773 |
DST[10]="http://www.centos.org/=URL_LL="
|
|
|
49237e |
DST[11]="$(cli_getPathComponent "$FLAG_BASEARCH" '--architecture')"
|
|
|
f4f773 |
DST[12]="http://wiki.centos.org/=URL_LL="
|
|
|
f4f773 |
DST[13]="http://lists.centos.org/=URL_LL="
|
|
|
f4f773 |
DST[14]="http://forums.centos.org/=URL_LL="
|
|
|
f4f773 |
DST[15]="http://mirrors.centos.org/=URL_LL="
|
|
|
f4f773 |
DST[16]="http://docs.centos.org/=URL_LL="
|
|
|
88f09f |
DST[17]="centos-docs@centos.org"
|
|
|
64e325 |
if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then
|
|
|
64e325 |
DST[18]="$(cli_getCurrentLocale '--langcode-only')/"
|
|
|
64e325 |
else
|
|
|
f4f773 |
DST[18]=""
|
|
|
64e325 |
fi
|
|
|
f4f773 |
if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then
|
|
|
f4f773 |
DST[19]="$(cli_getCurrentLocale '--langcode-only')."
|
|
|
f4f773 |
else
|
|
|
f4f773 |
DST[19]=""
|
|
|
f4f773 |
fi
|
|
|
f4f773 |
DST[20]='http://www.centos.org/modules/tinycontent/index.php?id=8'
|
|
|
88f09f |
DST[21]="$(cli_getCurrentLocale '--langcode-only')"
|
|
|
6e7d60 |
DST[22]="$(cli_getCurrentLocale)"
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
while [[ $COUNTDST -lt ${#DST[@]} ]];do
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
if [[ ! ${DST[$COUNTDST]} =~ '=[A-Z_]+=' ]];then
|
|
|
9b4d7d |
|
|
|
9b4d7d |
COUNTDST=$(($COUNTDST + 1))
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
continue
|
|
|
9b4d7d |
fi
|
|
|
9b4d7d |
|
|
|
9b4d7d |
while [[ $COUNTSRC -lt ${#SRC[*]} ]];do
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
DST[$COUNTDST]=$(echo ${DST[$COUNTDST]} \
|
|
|
9b4d7d |
| sed -r "s!${SRC[$COUNTSRC]}!${DST[$COUNTSRC]}!g")
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
COUNTSRC=$(($COUNTSRC + 1))
|
|
|
9b4d7d |
|
|
|
9b4d7d |
done
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
COUNTSRC=0
|
|
|
9b4d7d |
|
|
|
9b4d7d |
|
|
|
9b4d7d |
COUNTDST=$(($COUNTDST + 1))
|
|
|
9b4d7d |
|
|
|
9b4d7d |
done
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
while [[ ${COUNT} -lt ${#SRC[*]} ]];do
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
28f865 |
sed -r -i "s!${SRC[$COUNT]}!${DST[$COUNT]}!g" ${LOCATION}
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
COUNT=$(($COUNT + 1))
|
|
|
ce40cb |
|
|
|
ce40cb |
done
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
|
|
|
ce40cb |
unset SRC
|
|
|
ce40cb |
unset DST
|
|
|
ce40cb |
|
|
|
ce40cb |
}
|