feat(profile): expose default_document_language in profile API and UI

- Add default_document_language to ProfileResponse and ProfileUpdateRequest
- Handle validation in PATCH /api/profile endpoint
- Add dropdown in profile.html template with Alpine.js binding
- Add translation keys for profile UI labels
- Add comprehensive tests for profile default language feature

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-16 12:13:54 +00:00
parent 3a221a62cd
commit 075a505085
6 changed files with 566 additions and 1 deletions
+24
View File
@@ -231,6 +231,28 @@
{{ _("profile.theme_hint") }}
</p>
</fieldset>
<!-- Default Document Language -->
<div>
<label for="doc-lang-select" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
<i class="fas fa-language text-gray-400 mr-1" aria-hidden="true"></i>{{ _("profile.default_document_language_label") }}
</label>
<select
id="doc-lang-select"
x-model="form.default_document_language"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm text-sm
focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"
style="min-height:44px;"
>
<option value="">{{ _("profile.default_document_language_auto") }}</option>
{% for lang in supported_languages %}
<option value="{{ lang.code }}">{{ lang.flag }} {{ lang.native }} ({{ lang.name }})</option>
{% endfor %}
</select>
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
{{ _("profile.default_document_language_hint") }}
</p>
</div>
</div>
</section>
@@ -340,6 +362,7 @@ function profileSettings() {
contact_email: '',
preferred_language: '',
preferred_theme: 'system',
default_document_language: '',
},
pwForm: {
@@ -363,6 +386,7 @@ function profileSettings() {
this.form.contact_email = data.contact_email || '';
this.form.preferred_language = data.preferred_language || '';
this.form.preferred_theme = data.preferred_theme || 'system';
this.form.default_document_language = data.default_document_language || '';
this._initialLanguage = this.form.preferred_language;
} catch (_e) {
// Silently ignore — user might not be logged in (rare for this page)
+3
View File
@@ -1377,6 +1377,9 @@
"profile.contact_email_label": "Contact / Notification E-mail",
"profile.contact_email_placeholder": "you@example.com",
"profile.current_password": "Current Password",
"profile.default_document_language_auto": "Use system default",
"profile.default_document_language_hint": "Documents in other languages are automatically translated into this language. Leave blank to use the system default (English).",
"profile.default_document_language_label": "Default Document Language",
"profile.dismiss": "Dismiss",
"profile.display_name_hint": "Leave blank to use your account username or email.",
"profile.display_name_label": "Display Name",