From 6caac50138408bf8f9edefa7ad61ed275a274996 Mon Sep 17 00:00:00 2001 From: Arnold Wender Date: Wed, 15 Apr 2026 23:37:12 +0200 Subject: [PATCH] fix(i18n): use Optional[str] for Python 3.9 compatibility PEP 604 union syntax (str | None) requires Python 3.10+. The project supports 3.9 per CI matrix, so use typing.Optional instead. --- mempalace/i18n/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mempalace/i18n/__init__.py b/mempalace/i18n/__init__.py index 564bf2c..b76ba19 100644 --- a/mempalace/i18n/__init__.py +++ b/mempalace/i18n/__init__.py @@ -15,6 +15,7 @@ and the README section "Adding a new language" for the schema. import json from pathlib import Path +from typing import Optional _LANG_DIR = Path(__file__).parent _strings: dict = {} @@ -24,7 +25,7 @@ _current_lang: str = "en" _entity_cache: dict = {} -def _canonical_lang(lang: str) -> str | None: +def _canonical_lang(lang: str) -> Optional[str]: """Resolve a language code to its on-disk canonical filename stem. BCP 47 tags are case-insensitive (RFC 5646 ยง2.1.1), and the locale