diff --git a/buzz/locale.py b/buzz/locale.py index 299e03067..43f923b73 100644 --- a/buzz/locale.py +++ b/buzz/locale.py @@ -1,3 +1,4 @@ +import os import logging import gettext @@ -9,10 +10,14 @@ locale_dir = get_path("locale") gettext.bindtextdomain("buzz", locale_dir) -logging.debug(f"UI locales {QLocale().uiLanguages()}") +custom_locale = os.getenv("BUZZ_LOCALE") + +languages = [custom_locale] if custom_locale else QLocale().uiLanguages() + +logging.debug(f"UI locales {languages}") translate = gettext.translation( - APP_NAME.lower(), locale_dir, languages=QLocale().uiLanguages(), fallback=True + APP_NAME.lower(), locale_dir, languages=languages, fallback=True ) _ = translate.gettext diff --git a/docs/docs/preferences.md b/docs/docs/preferences.md index 05386dc63..2adc80bac 100644 --- a/docs/docs/preferences.md +++ b/docs/docs/preferences.md @@ -90,3 +90,5 @@ combined to produce the final answer. Defaults to [user_cache_dir](https://pypi.org/project/platformdirs/). **BUZZ_FAVORITE_LANGUAGES** - Coma separated list of supported language codes to show on top of language list. + +**BUZZ_LOCALE** - Buzz UI locale to use. Defaults to one of supported system locales.