|
|
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
|
|
|
878a2b |
# the repository.
|
|
|
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 default value returned by this function.
|
|
|
878a2b |
local LOCALIZED='false'
|
|
|
878a2b |
|
|
|
878a2b |
# Initialize location will use as reference to determine whether
|
|
|
878a2b |
# it can have translation messages or not.
|
|
|
878a2b |
local LOCATION="$1"
|
|
|
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.
|
|
|
878a2b |
cli_checkFiles $LOCATION -d
|
|
|
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.
|
|
|
878a2b |
DIRS[++((${#DIRS[*]}))]="$(cli_getRepoTLDir)/Identity/Models/Themes/[[:alnum:]-]+/(Distro/$(\
|
|
|
878a2b |
cli_getPathComponent --release-pattern)/Anaconda|Concept|Posters|Media)"
|
|
|
7952f7 |
DIRS[++((${#DIRS[*]}))]="$(cli_getRepoTLDir)/Documentation/Models/Docbook/[[:alnum:]-]+$"
|
|
|
391ffe |
DIRS[++((${#DIRS[*]}))]="$(cli_getRepoTLDir)/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
|
|
|
878a2b |
LOCALIZED='true'
|
|
|
878a2b |
break
|
|
|
878a2b |
fi
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
# Output final answer to all verifications.
|
|
|
878a2b |
echo "$LOCALIZED"
|
|
|
878a2b |
|
|
|
878a2b |
}
|