|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
957ef9 |
# locale.sh -- This function provides internationalization features
|
|
|
957ef9 |
# for centos-art.sh script through gettext standard processes.
|
|
|
4c79b5 |
#
|
|
|
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 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function locale {
|
|
|
4c79b5 |
|
|
|
f1a655 |
# Do not locale messages for English language. The English
|
|
|
f1a655 |
|
|
|
f1a655 |
|
|
|
f1a655 |
if [[ $(cli_getCurrentLocale) =~ '^en' ]];then
|
|
|
510fad |
cli_printMessage "`gettext "Cannot locale English language to itself."`" --as-error-line
|
|
|
f1a655 |
fi
|
|
|
f1a655 |
|
|
|
73abe0 |
local ACTIONNAM=''
|
|
|
73abe0 |
local ACTIONVAL=''
|
|
|
73abe0 |
|
|
|
2b3016 |
|
|
|
bf6bff |
|
|
|
bf6bff |
|
|
|
bf6bff |
# related object or not.
|
|
|
0d4faa |
local FLAG_DONT_CREATE_MO='false'
|
|
|
2b3016 |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
# location for subverion operations (e.g., status, update, commit,
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
L10N_BASEDIR="$(cli_getRepoTLDir)/Locales"
|
|
|
34cd8d |
|
|
|
73abe0 |
# Interpret arguments and options passed through command-line.
|
|
|
9fe4a2 |
locale_getOptions
|
|
|
73abe0 |
|
|
|
73abe0 |
# Redefine positional parameters using ARGUMENTS. At this point,
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
eval set -- "$ARGUMENTS"
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
34cd8d |
# Syncronize changes between repository and working copy. At this
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
cli_syncroRepoChanges "${L10N_BASEDIR}"
|
|
|
34cd8d |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
for ACTIONVAL in "$@";do
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
dc2f3c |
ACTIONVAL=$(cli_checkRepoDirSource $ACTIONVAL)
|
|
|
73abe0 |
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
WORKDIR=$(echo ${ACTIONVAL} \
|
|
|
dda52c |
| sed -r -e "s!trunk/(Identity|Scripts|Manuals)!trunk/Locales/\1!")
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
# (e.g., the .po, .pot and .mo files) will be stored in. The
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
|
|
|
ed2bf0 |
WORKDIR=$WORKDIR/$(cli_getCurrentLocale)
|
|
|
ed2bf0 |
|
|
|
34cd8d |
|
|
|
34cd8d |
if [[ ! -d ${WORKDIR} ]];then
|
|
|
34cd8d |
|
|
|
34cd8d |
# Print separator line.
|
|
|
34cd8d |
cli_printMessage "-" --as-separator-line
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
cli_printMessage "${WORKDIR}" --as-creating-line
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
mkdir -p ${WORKDIR}
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
cli_commitRepoChanges "${L10N_BASEDIR}"
|
|
|
34cd8d |
|
|
|
34cd8d |
fi
|
|
|
73abe0 |
|
|
|
73abe0 |
|
|
|
73abe0 |
if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then
|
|
|
73abe0 |
eval $ACTIONNAM
|
|
|
73abe0 |
else
|
|
|
510fad |
cli_printMessage "`gettext "A valid action is required."`" --as-error-line
|
|
|
73abe0 |
fi
|
|
|
73abe0 |
|
|
|
73abe0 |
done
|
|
|
4c79b5 |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
|
|
|
34cd8d |
cli_commitRepoChanges "${L10N_BASEDIR}"
|
|
|
34cd8d |
|
|
|
4c79b5 |
}
|