|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
73bb34 |
# locale_isLocalizable.sh -- This function determines whether a file or
|
|
|
878a2b |
# directory can have translation messages or not. This is the way we
|
|
|
878a2b |
# standardize what locations can be localized and what cannot inside
|
|
|
1dcaa7 |
# the repository. This function returns 0 when the path is localizable
|
|
|
1dcaa7 |
# and 1 when it is not.
|
|
|
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 |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
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 |
|
|
|
73bb34 |
function locale_isLocalizable {
|
|
|
878a2b |
|
|
|
878a2b |
local DIR=''
|
|
|
878a2b |
local -a DIRS
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize location will use as reference to determine whether
|
|
|
878a2b |
# it can have translation messages or not.
|
|
|
878a2b |
local LOCATION="$1"
|
|
|
1dcaa7 |
|
|
|
1dcaa7 |
# When no variable is passed to this function, use the action
|
|
|
1dcaa7 |
# value instead.
|
|
|
1dcaa7 |
if [[ $LOCATION == '' ]];then
|
|
|
1dcaa7 |
LOCATION=${ACTIONVAL}
|
|
|
1dcaa7 |
fi
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine location to be sure we'll always evaluate a directory,
|
|
|
878a2b |
# as reference location.
|
|
|
878a2b |
if [[ -f $LOCATION ]];then
|
|
|
878a2b |
LOCATION=$(dirname $LOCATION)
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
# Verify location existence. If it doesn't exist we cannot go on.
|
|
|
aed54d |
cli_checkFiles -e $LOCATION
|
|
|
878a2b |
|
|
|
878a2b |
# Define regular expresion list of all directories inside the
|
|
|
878a2b |
# repository that can have translation. These are the
|
|
|
878a2b |
# locale-specific directories will be created for.
|
|
|
aed54d |
DIRS[++((${#DIRS[*]}))]="${TCAR_WORKDIR}/trunk/Identity/Models/Themes/[[:alnum:]-]+/(Distro/$(\
|
|
|
878a2b |
cli_getPathComponent --release-pattern)/Anaconda|Concept|Posters|Media)"
|
|
|
aed54d |
DIRS[++((${#DIRS[*]}))]="${TCAR_WORKDIR}/trunk/Documentation/Models/Docbook/[[:alnum:]-]+$"
|
|
|
aed54d |
DIRS[++((${#DIRS[*]}))]="${TCAR_WORKDIR}/trunk/Scripts/Bash$"
|
|
|
878a2b |
|
|
|
878a2b |
# Verify location passed as first argument agains the list of
|
|
|
878a2b |
# directories that can have translation messages. By default, the
|
|
|
878a2b |
# location passed as first argument is considered as a location
|
|
|
878a2b |
# that cannot have translation messages until a positive answer
|
|
|
878a2b |
# says otherwise.
|
|
|
878a2b |
for DIR in ${DIRS[@]};do
|
|
|
878a2b |
if [[ $LOCATION =~ $DIR ]];then
|
|
|
1dcaa7 |
return 0
|
|
|
878a2b |
fi
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
# Output final answer to all verifications.
|
|
|
1dcaa7 |
return 1
|
|
|
878a2b |
|
|
|
878a2b |
}
|