mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Work on lang #332
This commit is contained in:
@@ -193,6 +193,11 @@ function getString (key) {
|
|||||||
}
|
}
|
||||||
result = getCache(`pia_lang_${key}_${lang_code}`, true);
|
result = getCache(`pia_lang_${key}_${lang_code}`, true);
|
||||||
|
|
||||||
|
if(isEmpty(result))
|
||||||
|
{
|
||||||
|
result = getCache(`pia_lang_${key}_en_us`, true);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,6 +481,12 @@ function navigateToDeviceWithIp (ip) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
function isEmpty(value)
|
||||||
|
{
|
||||||
|
return emptyArr.includes(value)
|
||||||
|
}
|
||||||
|
|
||||||
// initialize
|
// initialize
|
||||||
cacheSettings()
|
cacheSettings()
|
||||||
cacheStrings()
|
cacheStrings()
|
||||||
|
|||||||
@@ -73,9 +73,20 @@ function lang($key)
|
|||||||
// Merge JSON data with SQL data
|
// Merge JSON data with SQL data
|
||||||
$mergedLanguageData = mergeLanguageData($languageData, $sqlLanguageData);
|
$mergedLanguageData = mergeLanguageData($languageData, $sqlLanguageData);
|
||||||
|
|
||||||
$result = $mergedLanguageData[$pia_lang_selected][$key] ?? "String Not found for key ".$key;
|
// Check if the key exists in the selected language
|
||||||
|
if (isset($mergedLanguageData[$pia_lang_selected][$key])) {
|
||||||
|
$result = $mergedLanguageData[$pia_lang_selected][$key];
|
||||||
|
} else {
|
||||||
|
// If key not found in selected language, use "en_us" as fallback
|
||||||
|
if (isset($mergedLanguageData['en_us'][$key])) {
|
||||||
|
$result = $mergedLanguageData['en_us'][$key];
|
||||||
|
} else {
|
||||||
|
// If key not found in "en_us" either, use a default string
|
||||||
|
$result = "String Not found for key " . $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ last_cleanup = ''
|
|||||||
last_update_vendors = ''
|
last_update_vendors = ''
|
||||||
last_version_check = ''
|
last_version_check = ''
|
||||||
check_report = []
|
check_report = []
|
||||||
log_timestamp = 0
|
|
||||||
arpscan_devices = []
|
arpscan_devices = []
|
||||||
|
|
||||||
# for MQTT
|
# for MQTT
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
|
import re
|
||||||
from helper import timeNowTZ, get_setting, get_setting_value
|
from helper import timeNowTZ, get_setting, get_setting_value
|
||||||
from scanners.internet import check_IP_format, get_internet_IP
|
from scanners.internet import check_IP_format, get_internet_IP
|
||||||
from logger import mylog, print_log
|
from logger import mylog, print_log
|
||||||
|
|||||||
@@ -183,8 +183,6 @@ def importConfigs (db):
|
|||||||
conf.check_report = [1, "internet_IP", "update_vendors_silent"]
|
conf.check_report = [1, "internet_IP", "update_vendors_silent"]
|
||||||
conf.plugins_once_run = False
|
conf.plugins_once_run = False
|
||||||
|
|
||||||
# to be deleted if not used
|
|
||||||
conf.log_timestamp = conf.time_started
|
|
||||||
#cron_instance = Cron()
|
#cron_instance = Cron()
|
||||||
|
|
||||||
# timestamps of last execution times
|
# timestamps of last execution times
|
||||||
|
|||||||
@@ -64,10 +64,7 @@ def print_log (pText):
|
|||||||
# log_timestamp2, ' ',
|
# log_timestamp2, ' ',
|
||||||
log_timestamp2.strftime ('%H:%M:%S'), ' ',
|
log_timestamp2.strftime ('%H:%M:%S'), ' ',
|
||||||
pText)
|
pText)
|
||||||
|
|
||||||
|
|
||||||
# Save current time to calculate elapsed time until next log
|
|
||||||
conf.log_timestamp = log_timestamp2
|
|
||||||
|
|
||||||
return pText
|
return pText
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user