|
Alain Reguera Delgado |
8f60cb |
#!/bin/bash
|
|
Alain Reguera Delgado |
5f643d |
######################################################################
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
# locale.sh -- This module standardizes localization inside the
|
|
Alain Reguera Delgado |
5f643d |
# repository.
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
# Written by:
|
|
Alain Reguera Delgado |
5f643d |
# * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
# Copyright (C) 2009-2013 The CentOS Project
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
# This program is free software; you can redistribute it and/or modify
|
|
Alain Reguera Delgado |
5f643d |
# it under the terms of the GNU General Public License as published by
|
|
Alain Reguera Delgado |
5f643d |
# the Free Software Foundation; either version 2 of the License, or
|
|
Alain Reguera Delgado |
5f643d |
# (at your option) any later version.
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
# This program is distributed in the hope that it will be useful, but
|
|
Alain Reguera Delgado |
5f643d |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Alain Reguera Delgado |
5f643d |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
5f643d |
# General Public License for more details.
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
# You should have received a copy of the GNU General Public License
|
|
Alain Reguera Delgado |
5f643d |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
5f643d |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Alain Reguera Delgado |
5f643d |
#
|
|
Alain Reguera Delgado |
5f643d |
######################################################################
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
function locale {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
e8f8e0 |
local SUBMODULES=''
|
|
Alain Reguera Delgado |
e8f8e0 |
|
|
Alain Reguera Delgado |
e8f8e0 |
# Interpret arguments and options passed through command-line.
|
|
Alain Reguera Delgado |
52ee2e |
locale_getOptions "${@}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
e8f8e0 |
# Redefine positional parameters using ARGUMENTS local variable.
|
|
Alain Reguera Delgado |
e8f8e0 |
# At this point, option arguments have been removed from
|
|
Alain Reguera Delgado |
e8f8e0 |
# TCAR_ARGUMENTS variable and only non-option arguments remain in
|
|
Alain Reguera Delgado |
e8f8e0 |
# it.
|
|
Alain Reguera Delgado |
52ee2e |
eval set -- "${TCAR_ARGUMENTS}"
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
e8f8e0 |
# Verify the current locale information to avoid English messages
|
|
Alain Reguera Delgado |
e8f8e0 |
# from being localized to themselves. The English language is used
|
|
Alain Reguera Delgado |
e8f8e0 |
# as reference to write translatable strings inside the source
|
|
Alain Reguera Delgado |
e8f8e0 |
# files.
|
|
Alain Reguera Delgado |
52ee2e |
if [[ ${TCAR_SCRIPT_LANG_LC} =~ '^en' ]];then
|
|
Alain Reguera Delgado |
52ee2e |
tcar_printMessage "`gettext "The English language cannot be localized to itself."`" --as-error-line
|
|
Alain Reguera Delgado |
52ee2e |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
e8f8e0 |
# Process arguments passed to locale module, based on whether they
|
|
Alain Reguera Delgado |
e8f8e0 |
# are files or directories.
|
|
Alain Reguera Delgado |
786ac0 |
for ARGUMENT in ${@};do
|
|
Alain Reguera Delgado |
e8f8e0 |
|
|
Alain Reguera Delgado |
e8f8e0 |
local ARGUMENT=$(tcar_checkRepoDirSource "${ARGUMENT}")
|
|
Alain Reguera Delgado |
e8f8e0 |
|
|
Alain Reguera Delgado |
786ac0 |
if [[ -f ${ARGUMENT} ]];then
|
|
Alain Reguera Delgado |
e8f8e0 |
tcar_setSubModuleEnvironment "file" "${@}"
|
|
Alain Reguera Delgado |
786ac0 |
elif [[ -d ${ARGUMENT} ]];then
|
|
Alain Reguera Delgado |
e8f8e0 |
tcar_setSubModuleEnvironment "directory" "${@}"
|
|
Alain Reguera Delgado |
786ac0 |
else
|
|
Alain Reguera Delgado |
786ac0 |
tcar_printMessage "`gettext "The argument provided isn't valid."`" --as-error-line
|
|
Alain Reguera Delgado |
786ac0 |
fi
|
|
Alain Reguera Delgado |
e8f8e0 |
|
|
Alain Reguera Delgado |
8f60cb |
done
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|