From e5ed2ea42fd45d240623d6774866f1e8adad54a2 Mon Sep 17 00:00:00 2001 From: frederik Date: Tue, 8 Jul 2025 19:54:20 +0200 Subject: [PATCH] make the language setting a bit more robust --- scripts/config.php | 4 +++- scripts/install_language_label.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/config.php b/scripts/config.php index 3923c02..d60658d 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -143,7 +143,9 @@ if(isset($_GET["latitude"])){ $contents = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY=.*/", "APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY=$apprise_notify_new_species_each_day", $contents); $contents = preg_replace("/APPRISE_WEEKLY_REPORT=.*/", "APPRISE_WEEKLY_REPORT=$apprise_weekly_report", $contents); $contents = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents); - $contents = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents); + if(strlen($language) == 2){ + $contents = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents); + } $contents = preg_replace("/INFO_SITE=.*/", "INFO_SITE=$info_site", $contents); $contents = preg_replace("/COLOR_SCHEME=.*/", "COLOR_SCHEME=$color_scheme", $contents); $contents = preg_replace("/FLICKR_FILTER_EMAIL=.*/", "FLICKR_FILTER_EMAIL=$flickr_filter_email", $contents); diff --git a/scripts/install_language_label.sh b/scripts/install_language_label.sh index 2c60612..0bddeec 100755 --- a/scripts/install_language_label.sh +++ b/scripts/install_language_label.sh @@ -9,4 +9,4 @@ fi label_file_name="labels_${DATABASE_LANG}.txt" -ln -sf ${BASEDIR}/${label_file_name} $HOME/BirdNET-Pi/model/labels.txt +[ -f "${label_file_name}" ] && ln -sf ${BASEDIR}/${label_file_name} $HOME/BirdNET-Pi/model/labels.txt