_msg: Debug

This commit is contained in:
Stig-Ørjan Smelror 2024-02-14 13:24:28 +01:00
parent 96b26305d8
commit 000cee4e49

10
qsgen2
View File

@ -57,6 +57,7 @@ if ! $found; then
# Fallback or error handling # Fallback or error handling
fi fi
echo "Language loaded: ${language}" echo "Language loaded: ${language}"
echo "Localization array contents: ${(@kv)localization}"
if (${globaldebug}); then if (${globaldebug}); then
qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' ) qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' )
@ -73,13 +74,12 @@ function _msg() {
local full_msg="" local full_msg=""
for arg in "$@"; do for arg in "$@"; do
# Check if argument is a key in the localization array
if [[ -n "${localization[$arg]}" ]]; then if [[ -n "${localization[$arg]}" ]]; then
# Append the localized message to full_msg, ensuring safe expansion echo "Found key: $arg" # Debug line to confirm key is found
full_msg+="${(q)localization[$arg]}" full_msg+="${localization[$arg]}"
else else
# Argument not a key, treat as a literal string and append, ensuring safe expansion echo "Key not found: $arg" # Debug line for keys not found
full_msg+="${(q)arg}" full_msg+="$arg"
fi fi
done done