mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-08-11 00:30:12 -04:00
chore(i18n): extend parity gate to all locales with strict/info tiers Previously the script only inspected en/zh-CN/zh-TW, leaving de/fr/it/ja/pt-BR drift invisible. Now locales are auto-discovered from src/i18n/locales/, and a STRICT list (de, zh-CN, zh-TW — currently in parity) gates CI while the rest report informationally until their drift is caught up. ja notably has 27 real placeholder bugs worth fixing before promotion to strict.
26 lines
944 B
Python
26 lines
944 B
Python
"""Shared path resolution helpers.
|
|
|
|
Centralises the DATA_DIR fallback used by ``auth.py`` (``.jwt_secret``) and
|
|
``encryption.py`` (``.mfa_encryption_key``) so both modules read the
|
|
environment variable fresh on every call. Reading fresh — instead of caching
|
|
the value at module import — is required so test fixtures can override
|
|
``DATA_DIR`` per-test via ``monkeypatch.setenv`` and have the override take
|
|
effect immediately.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
def resolve_data_dir() -> Path:
|
|
"""Return the data directory, reading ``DATA_DIR`` fresh from env on each call.
|
|
|
|
Falls back to ``<project_root>/data`` when ``DATA_DIR`` is not set, matching
|
|
the behaviour of ``backend/app/core/auth.py:_get_jwt_secret``.
|
|
"""
|
|
data_dir_env = os.environ.get("DATA_DIR")
|
|
if data_dir_env:
|
|
return Path(data_dir_env)
|
|
return Path(__file__).parent.parent.parent.parent / "data"
|