Skip to content

A live bird collage card for your Home Assistant dashboard.

make the language setting a bit more robust

frederike5ed2ea42fd4
diff --git a/scripts/config.php b/scripts/config.php
index 3923c022..d60658dc 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 2c606124..0bddeec2 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