fix: support non-ascii languages in the spectrogram

This commit is contained in:
frederik
2025-05-01 19:49:52 +02:00
parent 0eab5428e4
commit ce38e3c5ad
3 changed files with 36 additions and 10 deletions
+16
View File
@@ -12,6 +12,22 @@ _settings = None
DB_PATH = os.path.expanduser('~/BirdNET-Pi/scripts/birds.db')
ANALYZING_NOW = os.path.expanduser('~/BirdSongs/StreamData/analyzing_now.txt')
FONT_DIR = os.path.expanduser('~/BirdNET-Pi/homepage/static')
def get_font():
conf = get_settings()
if conf['DATABASE_LANG'] == 'ar':
ret = {'font.family': 'Noto Sans Arabic', 'path': os.path.join(FONT_DIR, 'NotoSansArabic-Regular.ttf')}
elif conf['DATABASE_LANG'] in ['ja', 'zh']:
ret = {'font.family': 'Noto Sans JP', 'path': os.path.join(FONT_DIR, 'NotoSansJP-Regular.ttf')}
elif conf['DATABASE_LANG'] == 'ko':
ret = {'font.family': 'Noto Sans KR', 'path': os.path.join(FONT_DIR, 'NotoSansKR-Regular.ttf')}
elif conf['DATABASE_LANG'] == 'th':
ret = {'font.family': 'Noto Sans Thai', 'path': os.path.join(FONT_DIR, 'NotoSansThai-Regular.ttf')}
else:
ret = {'font.family': 'Roboto Flex', 'path': os.path.join(FONT_DIR, 'RobotoFlex-Regular.ttf')}
return ret
class PHPConfigParser(ConfigParser):