dev #2
1 changed files with 9 additions and 3 deletions
|
@ -120,6 +120,7 @@ def reload_if_changed():
|
|||
current_mtime = file_path.stat().st_mtime
|
||||
if current_mtime != last_mtime:
|
||||
print(f"[VOLTA] {RED}Translation file changed: {file_path}, reloading...{RESET}")
|
||||
_lookup_translation.cache_clear()
|
||||
load_translations()
|
||||
break
|
||||
except FileNotFoundError:
|
||||
|
@ -143,8 +144,8 @@ def set_language(lang: str):
|
|||
ENGLISH_MISSING = True
|
||||
_lookup_translation.cache_clear()
|
||||
|
||||
def check_missing_translations():
|
||||
global LOCALE, ENGLISH_MISSING
|
||||
def check_missing_translations(LOCALE=LOCALE):
|
||||
global ENGLISH_MISSING
|
||||
load_translations()
|
||||
if FALLBACK_LOCALE not in translations:
|
||||
print(f"[VOLTA] {RED}Fallback translations ({FALLBACK_LOCALE}.json) missing from assets/locales.{RESET}")
|
||||
|
@ -213,4 +214,9 @@ watchdog_thread = threading.Thread(target=reload_if_changed, daemon=True)
|
|||
watchdog_thread.start()
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Volta should not be run directly! Please use it as a module..")
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("LOCALE", help="Locale to validate")
|
||||
args = parser.parse_args()
|
||||
print("[VOLTA] Validating all locales....")
|
||||
check_missing_translations(LOCALE=f"{args.LOCALE}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue