Blame Automation/Modules/Locale/locale_setFileProcessing.sh
|
Alain Reguera Delgado |
786ac0 |
#!/bin/bash
|
|
Alain Reguera Delgado |
786ac0 |
function locale_setFileProcessing {
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local FILE=$(tcar_checkRepoDirSource "${1}")
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local FILE_NAME="$(basename ${FILE})"
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local FILE_EXTENSION=$(echo ${FILE} | sed -r 's/.+\.([[:alnum:]]+)$/\1/')
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local DIRECTORY=$(dirname ${FILE})
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local RENDER_FROM=$(tcar_getFilesList ${DIRECTORY} \
|
|
Alain Reguera Delgado |
786ac0 |
--pattern="^.+/.+\.${FILE_EXTENSION}$" --type="f")
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local LOCALE_FROM=${DIRECTORY}/Locales
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local POT_FILE=${LOCALE_FROM}/${FILE_NAME}.pot
|
|
Alain Reguera Delgado |
786ac0 |
local PO_FILE=${LOCALE_FROM}/${TCAR_SCRIPT_LANG_LC}/${FILE_NAME}.po
|
|
Alain Reguera Delgado |
786ac0 |
local MO_FILE=${LOCALE_FROM}/${TCAR_SCRIPT_LANG_LC}/LC_MESSAGES/${FILE_NAME}.mo
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
# The locale's modules require specific environment variables we
|
|
Alain Reguera Delgado |
786ac0 |
# need to define here in order for such modules to work as
|
|
Alain Reguera Delgado |
786ac0 |
# expected. From this point on we set such variables using the
|
|
Alain Reguera Delgado |
786ac0 |
# information set above.
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local RENDER_TYPE=${FILE_EXTENSION}
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
local -a TRANSLATIONS
|
|
Alain Reguera Delgado |
786ac0 |
TRANSLATIONS[0]=${PO_FILE}
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
for SOURCE in ${RENDER_FROM};do
|
|
Alain Reguera Delgado |
786ac0 |
SOURCES[((++${#SOURCES[*]}))]=${SOURCE}
|
|
Alain Reguera Delgado |
786ac0 |
done
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
# Initialize locale's action modules.
|
|
Alain Reguera Delgado |
786ac0 |
for LOCALE_ACTION in ${LOCALE_ACTIONS};do
|
|
Alain Reguera Delgado |
786ac0 |
tcar_setModuleEnvironment "${LOCALE_ACTION}" "${@}"
|
|
Alain Reguera Delgado |
786ac0 |
done
|
|
Alain Reguera Delgado |
786ac0 |
|
|
Alain Reguera Delgado |
786ac0 |
}
|