1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-11-05 23:40:13 +01:00
LibreTranslate/libretranslate/locales.py
2023-01-04 15:36:26 -05:00

9 lines
324 B
Python

import os
from functools import cache
@cache
def get_available_locales():
locales_dir = os.path.join(os.path.dirname(__file__), 'locales')
dirs = [os.path.join(locales_dir, d) for d in os.listdir(locales_dir)]
return ['en'] + [os.path.basename(d) for d in dirs if os.path.isdir(os.path.join(d, 'LC_MESSAGES'))]