Fix translations
Some checks failed
Gitea/kapitanbooru-uploader/pipeline/head There was a failure building this commit

This commit is contained in:
2025-03-03 18:53:59 +01:00
parent 9361bc0363
commit fa05de8c37
6 changed files with 12 additions and 14 deletions

View File

@ -1,16 +1,14 @@
import gettext
import locale
import os
from typing import Dict
from importlib.resources import files
class I18N:
def __init__(self, locale_dir=None):
# If no locale_dir is provided, use the locales folder relative to this file.
if locale_dir is None:
current_dir = os.path.dirname(os.path.abspath(__file__))
locale_dir = os.path.join(current_dir, "locales")
self.locale_dir = locale_dir
locale_dir = files("kapitanbooru_uploader").joinpath("locales")
self.locale_dir = str(locale_dir)
self.languages = {"en": "English", "pl": "Polski"}
self.current_lang = "en"
self.translations: Dict[str, str] = {}