|
|
e91a33 |
#!/bin/bash
|
|
|
e91a33 |
#
|
|
|
e91a33 |
# cli_getLocalizationDir.sh -- This function standardizes the way
|
|
|
e91a33 |
# localization paths are created. The first argument of this function
|
|
|
e91a33 |
# must be a path pointing a directory inside the repository.
|
|
|
e91a33 |
#
|
|
|
e91a33 |
# Copyright (C) 2009-2013 The CentOS Project
|
|
|
e91a33 |
#
|
|
|
e91a33 |
# This program is free software; you can redistribute it and/or modify
|
|
|
e91a33 |
# it under the terms of the GNU General Public License as published by
|
|
|
e91a33 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
e91a33 |
# your option) any later version.
|
|
|
e91a33 |
#
|
|
|
e91a33 |
# This program is distributed in the hope that it will be useful, but
|
|
|
e91a33 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
e91a33 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
e91a33 |
# General Public License for more details.
|
|
|
e91a33 |
#
|
|
|
e91a33 |
# You should have received a copy of the GNU General Public License
|
|
|
e91a33 |
# along with this program; if not, write to the Free Software
|
|
|
e91a33 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
e91a33 |
#
|
|
|
e91a33 |
# ----------------------------------------------------------------------
|
|
|
e91a33 |
# $Id$
|
|
|
e91a33 |
# ----------------------------------------------------------------------
|
|
|
e91a33 |
|
|
|
e91a33 |
function cli_getLocalizationDir {
|
|
|
e91a33 |
|
|
|
e91a33 |
# Sanitate non-option arguments to be sure they match the
|
|
|
e91a33 |
# directory conventions established by centos-art.sh script
|
|
|
e91a33 |
# against source directory locations in the working copy.
|
|
|
e91a33 |
LOCATION=$(cli_checkRepoDirSource "${1}")
|
|
|
e91a33 |
|
|
|
814e83 |
# In case the location specified would be a file, remove the file
|
|
|
814e83 |
# part from the path so only its parent directory remains.
|
|
|
814e83 |
if [[ -f ${LOCATION} ]];then
|
|
|
814e83 |
LOCATION=$(dirname ${LOCATION})
|
|
|
814e83 |
fi
|
|
|
814e83 |
|
|
|
e91a33 |
# Make path transformation.
|
|
|
e91a33 |
case "${2}" in
|
|
|
e91a33 |
|
|
|
814e83 |
'--no-lang' )
|
|
|
e91a33 |
LOCATION=$(echo "${LOCATION}" \
|
|
|
e91a33 |
| sed -r -e "s!(Identity|Scripts|Documentation)!Locales/\1!")
|
|
|
e91a33 |
;;
|
|
|
e91a33 |
|
|
|
e91a33 |
* )
|
|
|
e91a33 |
LOCATION=$(echo "${LOCATION}" \
|
|
|
e91a33 |
| sed -r -e "s!(Identity|Scripts|Documentation)!Locales/\1!")/${CLI_LANG_LC}
|
|
|
e91a33 |
;;
|
|
|
e91a33 |
|
|
|
e91a33 |
esac
|
|
|
e91a33 |
|
|
|
e91a33 |
# Output transformed path.
|
|
|
e91a33 |
echo "${LOCATION}"
|
|
|
e91a33 |
|
|
|
e91a33 |
}
|