|
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 |
bb076b |
# Copyright (C) 2009-2013 The CentOS Artwork SIG
|
|
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 |
bb076b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
Alain Reguera Delgado |
bb076b |
# 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 |
06ab0f |
local ACTIONS=''
|
|
Alain Reguera Delgado |
e8f8e0 |
|
|
Alain Reguera Delgado |
03cba4 |
# Define flags controlling locale module's file processing. There
|
|
Alain Reguera Delgado |
03cba4 |
# are three possible values here. Produce localization files for
|
|
Alain Reguera Delgado |
03cba4 |
# the file you provided in the command-line only (default
|
|
Alain Reguera Delgado |
03cba4 |
# behavior). --siblings, to produce localization files for all the
|
|
Alain Reguera Delgado |
03cba4 |
# siblings of the files you provided in the command-line,
|
|
Alain Reguera Delgado |
03cba4 |
# inclusively. --all, this option makes a recursive inside the
|
|
Alain Reguera Delgado |
03cba4 |
# directory of the file you provided as argument to the
|
|
Alain Reguera Delgado |
03cba4 |
# command-line and produces localization files for all files found.
|
|
Alain Reguera Delgado |
03cba4 |
LOCALE_FLAG_SIBLINGS="false"
|
|
Alain Reguera Delgado |
03cba4 |
LOCALE_FLAG_ALL="false"
|
|
Alain Reguera Delgado |
2eb4e7 |
|
|
Alain Reguera Delgado |
884aff |
# Define flags controlling locale module's processing reports.
|
|
Alain Reguera Delgado |
884aff |
LOCALE_FLAG_REPORT='false'
|
|
Alain Reguera Delgado |
884aff |
|
|
Alain Reguera Delgado |
e8f8e0 |
# Interpret arguments and options passed through command-line.
|
|
Alain Reguera Delgado |
06ab0f |
locale_getOptions
|
|
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 |
2eb4e7 |
if [[ ${TCAR_SCRIPT_LANG_LC} =~ '^C$' ]];then
|
|
Alain Reguera Delgado |
2eb4e7 |
tcar_printMessage "`gettext "The C locale 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 |
06ab0f |
for ARGUMENT in ${TCAR_MODULE_ARGUMENT};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 |
06ab0f |
tcar_setModuleEnvironment -m "file" -t "sub-module" "${ARGUMENT}"
|
|
Alain Reguera Delgado |
786ac0 |
elif [[ -d ${ARGUMENT} ]];then
|
|
Alain Reguera Delgado |
06ab0f |
tcar_setModuleEnvironment -m "directory" -t "sub-module" "${ARGUMENT}"
|
|
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 |
}
|