mirror of
https://github.com/relativemodder/aegnux.git
synced 2025-12-10 05:29:38 +05:00
22 lines
469 B
Python
22 lines
469 B
Python
import os
|
|
import importlib
|
|
from translations.en_US import STRINGS as EN_STRINGS
|
|
|
|
STRINGS = {}
|
|
|
|
def get_current_locale() -> str:
|
|
return os.getenv('LANG', 'en_US.UTF-8').split('.')[0]
|
|
|
|
def load_strings():
|
|
global STRINGS
|
|
|
|
locale = get_current_locale()
|
|
|
|
try:
|
|
mod = importlib.import_module(f'translations.{locale}')
|
|
STRINGS = mod.STRINGS
|
|
except:
|
|
STRINGS = EN_STRINGS
|
|
|
|
def gls(key: str) -> str:
|
|
return STRINGS.get(key, key) |