diff --git a/app/api/billing.py b/app/api/billing.py index 6b0f20dd..c28b6aa8 100644 --- a/app/api/billing.py +++ b/app/api/billing.py @@ -30,6 +30,7 @@ from app.auth import require_login from app.config import settings from app.database import get_db from app.models import SubscriptionPlan, UserProfile +from app.utils.i18n import translate as _translate from app.utils.user_scope import get_current_owner_id logger = logging.getLogger(__name__) @@ -37,6 +38,7 @@ router = APIRouter(prefix="/billing", tags=["billing"]) _templates_dir = pathlib.Path(__file__).parents[2] / "frontend" / "templates" _templates = Jinja2Templates(directory=str(_templates_dir)) +_templates.env.globals["_"] = lambda key, **kwargs: _translate(key, "en", **kwargs) def _get_stripe() -> stripe.StripeClient | None: diff --git a/app/api/local_auth.py b/app/api/local_auth.py index 8a8ce634..2b68003f 100644 --- a/app/api/local_auth.py +++ b/app/api/local_auth.py @@ -26,6 +26,7 @@ from starlette.responses import RedirectResponse from app.config import settings from app.database import get_db from app.models import LocalUser, UserProfile +from app.utils.i18n import translate as _translate from app.utils.local_auth import ( build_session_user, generate_token, @@ -41,6 +42,7 @@ router = APIRouter(tags=["local-auth"]) _templates_dir = pathlib.Path(__file__).parents[2] / "frontend" / "templates" templates = Jinja2Templates(directory=str(_templates_dir)) +templates.env.globals["_"] = lambda key, **kwargs: _translate(key, "en", **kwargs) DbSession = Annotated[Session, Depends(get_db)] diff --git a/app/auth.py b/app/auth.py index 3cb06465..5cb08abd 100644 --- a/app/auth.py +++ b/app/auth.py @@ -22,6 +22,7 @@ from app.middleware.audit_log import get_client_ip # Guards at call-sites ensure they are never *called* in single-user mode. from app.models import LocalUser as _LocalUser from app.models import UserProfile as _UserProfile +from app.utils.i18n import translate as _translate from app.utils.local_auth import build_session_user as _build_session_user from app.utils.local_auth import verify_password as _verify_password @@ -34,6 +35,7 @@ AUTH_ENABLED = settings.auth_enabled # Set up templates for authentication templates_dir = pathlib.Path(__file__).parents[1] / "frontend" / "templates" templates = Jinja2Templates(directory=str(templates_dir)) +templates.env.globals["_"] = lambda key, **kwargs: _translate(key, "en", **kwargs) # Configure OAuth provider if credentials are provided OAUTH_CONFIGURED = False diff --git a/frontend/templates/404.html b/frontend/templates/404.html index ca2f27ac..2bfc673a 100644 --- a/frontend/templates/404.html +++ b/frontend/templates/404.html @@ -1,16 +1,16 @@ {% extends "base.html" %} -{% block title %}404 - Not Found{% endblock %} +{% block title %}{{ _("error.404_title") }}{% endblock %} {% block content %}
- It seems DocuElevate has misplaced the document you were looking for. Don’t worry – we’ve got your back. + {{ _("error.404_message") }}
- ← Return Home + ← {{ _("error.404_home") }}
- Oops! Something Went Wrong. + {{ _("error.500_heading") }}
- Our servers encountered a mishap and need a moment. Maybe the hamsters spilled their coffee? + {{ _("error.500_message1") }}
- We're already on it—sorting files, rebooting servers, and recalibrating flux capacitors. + {{ _("error.500_message2") }}
{% if exc %}{{ exc }}
- Welcome to DocuElevate – your modern, intelligent solution for document processing! - We've built DocuElevate to completely transform the way you handle your documents – from upload - to extraction, from processing to storage. + {{ _("about.intro_pre") }}{{ _("app.name") }}{{ _("about.intro_post") }}
- DocuElevate was created with one goal in mind: to simplify and streamline document management - for everyone, whether you're a small startup or a large enterprise. + {{ _("about.story_p1") }}
- We harness the power of pluggable AI providers (OpenAI, Anthropic Claude, Google Gemini, Ollama, - OpenRouter, Portkey, and more) for metadata extraction and text refinement, integrate seamlessly - with Dropbox, Nextcloud, and Paperless NGX for storage and indexing, leverage Azure Document - Intelligence for OCR, and even use Gotenberg for file-to-PDF conversions. + {{ _("about.story_p2") }}
- DocuElevate is passionately developed by - Christian Krakau-Louis. + {{ _("about.creator_pre") }} + {{ _("about.creator_name") }}.
- We care about your privacy and data security. Please review our: + {{ _("about.legal_description") }}
- Want to dive into the code, contribute ideas, or learn more about DocuElevate? + {{ _("about.involved_description") }}
- Create personal API tokens to interact with the DocuElevate API programmatically. - Use tokens for webhook uploads, CI/CD pipelines, or any script that needs to upload - or retrieve documents. + {{ _("api_tokens.intro") }}