mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 22:55:46 +01:00
Adding locale override (#985)
This commit is contained in:
parent
df63b9d05a
commit
f61701f0b0
2 changed files with 9 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import logging
|
||||
import gettext
|
||||
|
||||
|
|
@ -9,10 +10,14 @@ from buzz.settings.settings import APP_NAME
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue