1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:23:12 +00:00

Add all localization strings to CONST

This commit is contained in:
wlinator 2024-08-28 06:35:27 -04:00
parent 9816826122
commit 1fd136e2ef

View file

@ -1,4 +1,5 @@
import os
import json
import yaml
from functools import lru_cache
from typing import Optional, Callable, Set
@ -11,6 +12,9 @@ class _parser:
def read_settings(self) -> dict:
return self._read_file("settings.yaml", yaml.safe_load)
def read_json(self, path: str) -> dict:
return self._read_file(f"localization/{path}.json", json.load)
def _read_file(self, file_path: str, load_func: Callable) -> dict:
with open(file_path) as file:
return load_func(file)
@ -36,5 +40,14 @@ class _constants:
set(_s["cogs"]["ignore"]) if _s["cogs"]["ignore"] else set()
)
# Reponse strings
# TODO: Implement switching between languages
STRINGS = _p.read_json("strings.en-US")
LEVEL_MESSAGES = _p.read_json("levels.en-US")
_bday = _p.read_json("bdays.en-US")
BIRTHDAY_MESSAGES = _bday["birthday_messages"]
BIRTHDAY_MONTHS = _bday["months"]
CONST: _constants = _constants()