Change name of localization array
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
typeset -A localization
 | 
					typeset -A qsgenlang
 | 
				
			||||||
localization=(
 | 
					qsgenlang=(
 | 
				
			||||||
_qsgen2_msg_1 "Usage: qsgen2 add \\"Site Name\\" \\"/path/to/project\\""
 | 
					_qsgen2_msg_1 "Usage: qsgen2 add \\"Site Name\\" \\"/path/to/project\\""
 | 
				
			||||||
_qsgen2_msg_2 "- Forced Update: Generating Everything"
 | 
					_qsgen2_msg_2 "- Forced Update: Generating Everything"
 | 
				
			||||||
_qsgen2_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *"
 | 
					_qsgen2_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
typeset -A localization
 | 
					typeset -A qsgenlang
 | 
				
			||||||
localization=(
 | 
					qsgenlang=(
 | 
				
			||||||
_qsgen2_msg_1 "Uso: qsgen2 add \"Nombre del Sitio\" \"ruta/al/proyecto\""
 | 
					_qsgen2_msg_1 "Uso: qsgen2 add \"Nombre del Sitio\" \"ruta/al/proyecto\""
 | 
				
			||||||
_qsgen2_msg_2 "- Actualización forzada: Generando todo"
 | 
					_qsgen2_msg_2 "- Actualización forzada: Generando todo"
 | 
				
			||||||
_qsgen2_msg_3 "* %SCRIPT_NAME% no puede analizar este sitio. Saliendo. *"
 | 
					_qsgen2_msg_3 "* %SCRIPT_NAME% no puede analizar este sitio. Saliendo. *"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
typeset -A localization
 | 
					typeset -A qsgenlang
 | 
				
			||||||
localization+=(
 | 
					qsgenlang=(
 | 
				
			||||||
_qsgen2_msg_2 "- Tvungen oppdatering: Genererer alt"
 | 
					_qsgen2_msg_2 "- Tvungen oppdatering: Genererer alt"
 | 
				
			||||||
_qsgen2_msg_3 "* %SCRIPT_NAME% kan ikke analysere dette nettstedet. Avslutter. *"
 | 
					_qsgen2_msg_3 "* %SCRIPT_NAME% kan ikke analysere dette nettstedet. Avslutter. *"
 | 
				
			||||||
_qsgen2_msg_4 "Vennligst installer Pandoc."
 | 
					_qsgen2_msg_4 "Vennligst installer Pandoc."
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								qsgen2
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								qsgen2
									
									
									
									
									
								
							@@ -58,7 +58,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}"
 | 
					echo "Localization array contents: ${(@kv)qsgenlang}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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)}' )
 | 
				
			||||||
@@ -69,15 +69,17 @@ if (${globaldebug}); then
 | 
				
			|||||||
    done
 | 
					    done
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Sample QSGenLang entry: ${qsgenlang[_qsgen2_msg_1]}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function _msg() {
 | 
					function _msg() {
 | 
				
			||||||
    local type=$1
 | 
					    local type=$1
 | 
				
			||||||
    shift  # Remove the first argument so $@ now contains only keys or additional strings
 | 
					    shift  # Remove the first argument so $@ now contains only keys or additional strings
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    local full_msg=""
 | 
					    local full_msg=""
 | 
				
			||||||
    for arg in "$@"; do
 | 
					    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
 | 
					            echo "Found key: $arg"  # Debug line to confirm key is found
 | 
				
			||||||
            full_msg+="${localization[$arg]}"
 | 
					            full_msg+="${qsgenlang[$arg]}"
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            echo "Key not found: $arg"  # Debug line for keys not found
 | 
					            echo "Key not found: $arg"  # Debug line for keys not found
 | 
				
			||||||
            full_msg+="$arg"
 | 
					            full_msg+="$arg"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user