Change name of localization array

This commit is contained in:
Stig-Ørjan Smelror 2024-02-14 13:37:58 +01:00
parent fd54fc7543
commit 4c21f669b7
4 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,5 @@
typeset -A localization
localization=(
typeset -A qsgenlang
qsgenlang=(
_qsgen2_msg_1 "Usage: qsgen2 add \\"Site Name\\" \\"/path/to/project\\""
_qsgen2_msg_2 "- Forced Update: Generating Everything"
_qsgen2_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *"

View File

@ -1,5 +1,5 @@
typeset -A localization
localization=(
typeset -A qsgenlang
qsgenlang=(
_qsgen2_msg_1 "Uso: qsgen2 add \"Nombre del Sitio\" \"ruta/al/proyecto\""
_qsgen2_msg_2 "- Actualización forzada: Generando todo"
_qsgen2_msg_3 "* %SCRIPT_NAME% no puede analizar este sitio. Saliendo. *"

View File

@ -1,5 +1,5 @@
typeset -A localization
localization+=(
typeset -A qsgenlang
qsgenlang=(
_qsgen2_msg_2 "- Tvungen oppdatering: Genererer alt"
_qsgen2_msg_3 "* %SCRIPT_NAME% kan ikke analysere dette nettstedet. Avslutter. *"
_qsgen2_msg_4 "Vennligst installer Pandoc."

8
qsgen2
View File

@ -58,7 +58,7 @@ if ! $found; then
# Fallback or error handling
fi
echo "Language loaded: ${language}"
echo "Localization array contents: ${(@kv)localization}"
echo "Localization array contents: ${(@kv)qsgenlang}"
if (${globaldebug}); then
qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' )
@ -69,15 +69,17 @@ if (${globaldebug}); then
done
fi
echo "Sample QSGenLang entry: ${qsgenlang[_qsgen2_msg_1]}"
function _msg() {
local type=$1
shift # Remove the first argument so $@ now contains only keys or additional strings
local full_msg=""
for arg in "$@"; do
if [[ -n "${localization[$arg]}" ]]; then
if [[ -n "${qsgenlang[$arg]}" ]]; then
echo "Found key: $arg" # Debug line to confirm key is found
full_msg+="${localization[$arg]}"
full_msg+="${qsgenlang[$arg]}"
else
echo "Key not found: $arg" # Debug line for keys not found
full_msg+="$arg"