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 %}
-

404

-

Oops, we couldn’t find that page!

+

{{ _("error.404_code") }}

+

{{ _("error.404_heading") }}

- 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") }}
diff --git a/frontend/templates/500.html b/frontend/templates/500.html index 523c5b08..a62c640a 100644 --- a/frontend/templates/500.html +++ b/frontend/templates/500.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Server Error - DocuElevate{% endblock %} +{% block title %}{{ _("error.500_title") }}{% endblock %} {% block content %}
@@ -7,27 +7,27 @@
Illustration of a server error
-

500

+

{{ _("error.500_code") }}

- 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 %}
- Show Debug Info + {{ _("error.500_debug_info") }}
{{ exc }}
@@ -35,7 +35,7 @@
diff --git a/frontend/templates/about.html b/frontend/templates/about.html index dff869bf..82af9083 100644 --- a/frontend/templates/about.html +++ b/frontend/templates/about.html @@ -1,69 +1,63 @@ {% extends "base.html" %} -{% block title %}About DocuElevate{% endblock %} +{% block title %}{{ _("about.page_title") }}{% endblock %} {% block content %}
-

About DocuElevate

+

{{ _("about.heading") }}

- 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") }}

-

Our Story

+

{{ _("about.story_heading") }}

- 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") }}

-

Key Features

+

{{ _("about.features_heading") }}

-

Document Processing

+

{{ _("about.features_processing_heading") }}

    -
  • Simple and secure file uploads with drag & drop support
  • -
  • OCR powered by Azure Document Intelligence
  • -
  • Automated metadata extraction using a pluggable AI provider
  • -
  • PDF conversion for various file formats via Gotenberg
  • -
  • Intelligent document classification and date extraction
  • +
  • {{ _("about.features_processing_upload") }}
  • +
  • {{ _("about.features_processing_ocr") }}
  • +
  • {{ _("about.features_processing_metadata") }}
  • +
  • {{ _("about.features_processing_pdf") }}
  • +
  • {{ _("about.features_processing_classification") }}
-

Integration & Storage

+

{{ _("about.features_integration_heading") }}

    -
  • Multi-destination support (store documents in multiple locations)
  • -
  • Cloud storage: Dropbox, Google Drive, OneDrive, Amazon S3
  • -
  • Self-hosted options: Nextcloud, Paperless NGX, WebDAV
  • -
  • Transfer protocols: FTP, SFTP, Email forwarding
  • +
  • {{ _("about.features_integration_multi_dest") }}
  • +
  • {{ _("about.features_integration_cloud") }}
  • +
  • {{ _("about.features_integration_selfhosted") }}
  • +
  • {{ _("about.features_integration_protocols") }}
-

Automation

+

{{ _("about.features_automation_heading") }}

    -
  • IMAP inbox polling from multiple sources
  • -
  • Gmail and generic email account integration
  • -
  • Automated document ingestion from various inputs
  • -
  • Background processing with Redis and Celery
  • +
  • {{ _("about.features_automation_imap") }}
  • +
  • {{ _("about.features_automation_gmail") }}
  • +
  • {{ _("about.features_automation_ingestion") }}
  • +
  • {{ _("about.features_automation_background") }}
-

Administration

+

{{ _("about.features_admin_heading") }}

    -
  • Powerful REST API for programmatic access
  • -
  • OAuth2 authentication support with Authentik
  • -
  • Highly configurable via environment variables
  • -
  • Docker-ready for easy deployment and scaling
  • +
  • {{ _("about.features_admin_api") }}
  • +
  • {{ _("about.features_admin_oauth2") }}
  • +
  • {{ _("about.features_admin_config") }}
  • +
  • {{ _("about.features_admin_docker") }}
@@ -71,43 +65,43 @@
-

Meet the Creator

+

{{ _("about.creator_heading") }}

- DocuElevate is passionately developed by - Christian Krakau-Louis. + {{ _("about.creator_pre") }} + {{ _("about.creator_name") }}.

-

Privacy & Legal

+

{{ _("about.legal_heading") }}

- We care about your privacy and data security. Please review our: + {{ _("about.legal_description") }}

-

Get Involved

+

{{ _("about.involved_heading") }}

- Want to dive into the code, contribute ideas, or learn more about DocuElevate? + {{ _("about.involved_description") }}

diff --git a/frontend/templates/api_tokens.html b/frontend/templates/api_tokens.html index bb8f7f2e..5e4633cf 100644 --- a/frontend/templates/api_tokens.html +++ b/frontend/templates/api_tokens.html @@ -1,32 +1,30 @@ {% extends "base.html" %} -{% block title %}API Tokens – DocuElevate{% endblock %} +{% block title %}{{ _("api_tokens.page_title") }}{% endblock %} {% block content %}

- API Tokens + {{ _("api_tokens.heading") }}

- 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") }}

-

Create New Token

+

{{ _("api_tokens.create_heading") }}

- + - + @@ -54,9 +52,9 @@
-

Token created successfully!

+

{{ _("api_tokens.token_created") }}

- Copy this token now — it will not be shown again. + {{ _("api_tokens.copy_warning_1") }} {{ _("api_tokens.copy_warning_2") }}.

- +
@@ -88,11 +86,11 @@

- Usage Example + {{ _("api_tokens.usage_heading") }}

- Use your API token in the Authorization - header with any API request: + {{ _("api_tokens.usage_intro_pre") }} Authorization + {{ _("api_tokens.usage_intro_post") }}

curl -X POST "/api/files/ui-upload" \
@@ -104,7 +102,7 @@
         class="absolute top-2 right-2 px-2 py-1 bg-gray-700 text-gray-300 rounded text-xs hover:bg-gray-600
                focus:outline-none focus:ring-2 focus:ring-indigo-500 transition-colors"
         style="min-height:30px; min-width:30px;"
-        aria-label="Copy upload example to clipboard"
+        aria-label="{{ _('api_tokens.copy_upload_example') }}"
       >
         
       
@@ -114,14 +112,14 @@
   
   
-

Your Tokens

+

{{ _("api_tokens.your_tokens") }}

@@ -129,24 +127,24 @@