From 96af711eacde8a42e31cbc513099a706afc42ca9 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 04:19:19 +0100 Subject: [PATCH 1/7] feat(i18n): apply saved language to shell and profile --- .../Commands/UpdateUser/UpdateUserHandler.cs | 6 +- src/Heimdall.Web/Components/App.razor | 1 + .../Components/Layout/MainLayout.razor | 72 ++-- .../Components/Pages/Dashboard.razor | 136 ++++--- .../Components/Pages/Profile.razor | 214 +++++----- .../Localization/SharedResources.cs | 4 + .../Localization/SharedResources.en.resx | 366 ++++++++++++++++++ .../Localization/SharedResources.fr.resx | 366 ++++++++++++++++++ src/Heimdall.Web/Program.cs | 2 + .../Services/UiLanguageService.cs | 60 +++ src/Heimdall.Web/wwwroot/js/localization.js | 10 + todo.md | 2 +- 12 files changed, 1048 insertions(+), 191 deletions(-) create mode 100644 src/Heimdall.Web/Localization/SharedResources.cs create mode 100644 src/Heimdall.Web/Services/UiLanguageService.cs create mode 100644 src/Heimdall.Web/wwwroot/js/localization.js diff --git a/src/Heimdall.Application/Users/Commands/UpdateUser/UpdateUserHandler.cs b/src/Heimdall.Application/Users/Commands/UpdateUser/UpdateUserHandler.cs index 8ac73e3..24dd249 100644 --- a/src/Heimdall.Application/Users/Commands/UpdateUser/UpdateUserHandler.cs +++ b/src/Heimdall.Application/Users/Commands/UpdateUser/UpdateUserHandler.cs @@ -25,6 +25,10 @@ public class UpdateUserHandler : IRequestHandler.NotFound("User not found"); + var language = command.Language?.Trim().ToLowerInvariant(); + if (language is not null && language is not ("fr" or "en")) + return ServiceResult.Failure("Langue non prise en charge", 400); + var oldEmail = user.Email; var oldEmailConfirmed = user.EmailConfirmed; var emailChanged = false; @@ -49,7 +53,7 @@ public class UpdateUserHandler : IRequestHandler + diff --git a/src/Heimdall.Web/Components/Layout/MainLayout.razor b/src/Heimdall.Web/Components/Layout/MainLayout.razor index d615486..b347161 100644 --- a/src/Heimdall.Web/Components/Layout/MainLayout.razor +++ b/src/Heimdall.Web/Components/Layout/MainLayout.razor @@ -1,7 +1,11 @@ @inherits LayoutComponentBase +@implements IDisposable @inject AuthState Auth @inject NavigationManager Navigation +@inject HeimdallApiClient Api @inject HeimdallAuthStateProvider AuthStateProvider +@inject UiLanguageService Language +@inject UiText Text @inject IJSRuntime JsRuntime @using Heimdall.Web.Theme @@ -10,18 +14,18 @@ - + - Heimdall @* Global Search *@ - @@ -30,12 +34,12 @@ @if (Auth.IsLoggedIn) { - + @@ -43,10 +47,10 @@ @Auth.User?.Email - Mon profil + @Text["Profile"] - Déconnexion + @Text["Logout"] } @@ -57,59 +61,59 @@ @if (Auth.IsLoggedIn) { - Navigation + @Text["Navigation"] - Dashboard + @Text["Dashboard"] - Sites & Caméras + @Text["SitesAndCameras"] - Événements + @Text["Events"] - Snapshots + @Text["Snapshots"] - Personnes + @Text["People"] @if (Auth.HasPermission("Admin.Users") || Auth.HasPermission("Admin.Manage")) { - Administration + @Text["Administration"] - @if (Auth.HasPermission("Admin.Users")) { - Utilisateurs + @Text["Users"] - Groupes + @Text["Groups"] - Rôles & Permissions + @Text["RolesAndPermissions"] } @if (Auth.HasPermission("Admin.Manage")) { - Matrice des permissions + @Text["PermissionMatrix"] } - Agents + @Text["Agents"] - Journal d'audit + @Text["AuditLog"] - Configuration + @Text["Settings"] } @@ -118,7 +122,7 @@ else { - Connexion + @Text["Login"] } @@ -143,16 +147,34 @@ protected override void OnInitialized() { + Language.LanguageChanged += OnLanguageChanged; _usersMenuOpen = Navigation.Uri.Contains("/users", StringComparison.OrdinalIgnoreCase) || Navigation.Uri.Contains("/admin/groups", StringComparison.OrdinalIgnoreCase) || Navigation.Uri.Contains("/admin/roles", StringComparison.OrdinalIgnoreCase) || Navigation.Uri.Contains("/admin/claims", StringComparison.OrdinalIgnoreCase); } + protected override async Task OnInitializedAsync() + { + if (!Auth.IsLoggedIn) return; + try + { + var profile = await Api.GetMyProfileAsync(); + if (profile is not null) Language.SetLanguage(profile.Language); + } + catch { /* Keep the request culture when the profile endpoint is unavailable. */ } + } + protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { + try + { + await JsRuntime.InvokeVoidAsync("heimdallLocalization.setLanguage", Language.Language); + } + catch { /* UI localization is still applied by the circuit service. */ } + try { // Restaure la préférence thème persistée (partagée avec les pages @@ -214,4 +236,8 @@ if (e.Key == "Enter") await DoSearch(); } + + private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged); + + public void Dispose() => Language.LanguageChanged -= OnLanguageChanged; } diff --git a/src/Heimdall.Web/Components/Pages/Dashboard.razor b/src/Heimdall.Web/Components/Pages/Dashboard.razor index 007cc59..9141160 100644 --- a/src/Heimdall.Web/Components/Pages/Dashboard.razor +++ b/src/Heimdall.Web/Components/Pages/Dashboard.razor @@ -5,51 +5,53 @@ @inject HeimdallApiClient Api @inject AuthState Auth @inject ISnackbar Snackbar +@inject UiLanguageService Language +@inject UiText Text - Dashboard + @Text["Dashboard"] - Bienvenue, @Auth.User?.DisplayName + @Text["WelcomeUser"], @Auth.User?.DisplayName - Dernière mise à jour : @_lastRefresh.ToString("T") + @Text["LastUpdated"] @_lastRefresh.ToString("T", Language.Culture) @* Stats Cards Row — tuiles uniformes (StatTile, hauteur 100%) *@ -
- @(_stats?.CamerasOnline ?? 0) en ligne - @(_stats?.CamerasOffline ?? 0) hors ligne + @(_stats?.CamerasOnline ?? 0) @Text["Online"] + @(_stats?.CamerasOffline ?? 0) @Text["Offline"]
-
- @(_stats?.TotalAgents ?? 0) total + @(_stats?.TotalAgents ?? 0) @Text["Total"]
-
- Voir tous → + @Text["ViewAll"] →
@@ -60,7 +62,7 @@ IconColor="Color.Info" Loading="@_loading">
- Gérer → + @Text["Manage"] →
@@ -70,13 +72,13 @@ @* Camera Status Breakdown *@ - + @if (_cameraStatusData is not null) { - Statut - Nombre + @Text["Status"] + @Text["Count"] @@ -98,7 +100,7 @@ @* Recent Events *@ - + @if (_recentEventsLoading) { @@ -109,12 +111,12 @@ { - Heure - Type - Confiance + @Text["Time"] + @Text["Type"] + @Text["Confidence"] - @context.OccurredAt.ToLocalTime().ToString("HH:mm") + @context.OccurredAt.ToLocalTime().ToString("t", Language.Culture) @FormatEventType(context.Type) @($"{context.Confidence:P0}") @@ -122,11 +124,11 @@ } else { - Aucun événement récent. + @Text["NoRecentEvents"] } - Voir tout → + @Text["ViewAll"] → @@ -136,7 +138,7 @@ @* Agent Workload *@ - + @if (_agentsLoading) { @@ -160,24 +162,24 @@ } - Tous les agents → + @Text["AllAgents"] → } else { - Aucun agent enregistré. + @Text["NoAgentsRegistered"] } @* Quick Actions *@ - +
- Événements + @Text["Events"]
@@ -185,7 +187,7 @@
- Nouveau site + @Text["NewSite"]
@@ -193,7 +195,7 @@
- Agents + @Text["Agents"]
@@ -201,7 +203,7 @@
- Audit + @Text["Audit"]
@@ -213,23 +215,23 @@ @* Sites Table *@ - + @if (_loading) { for (int i = 0; i < 3; i++) { } } else if (_sites?.Count > 0) { - Nom - Adresse - Statut - Créé le + @Text["Name"] + @Text["Address"] + @Text["Status"] + @Text["CreatedAt"] @context.Name @(context.Address ?? "—") - @(context.Enabled ? "Actif" : "Inactif") - @context.CreatedAt.ToString("g") + @(context.Enabled ? Text["Active"] : Text["Inactive"]) + @context.CreatedAt.ToString("g", Language.Culture) } @@ -237,19 +239,19 @@ {
- Aucun site configuré + @Text["NoSiteConfigured"] - Commencez par créer un site pour déployer vos agents de surveillance. + @Text["CreateSitePrompt"] - Créer un site + @Text["CreateSite"]
}
- - + +
@@ -268,15 +270,9 @@ private List? _agents; private List? _cameraStatusData; - private readonly List _defaultCameraStatus = - [ - new("En ligne", 0, Color.Success, 0), - new("Hors ligne", 0, Color.Error, 0), - new("Désactivée", 0, Color.Default, 0), - ]; - protected override async Task OnInitializedAsync() { + Language.LanguageChanged += OnLanguageChanged; await LoadData(); } @@ -333,16 +329,7 @@ // Stats _stats = await Api.GetStatsAsync(); if (_stats is not null) - { - var total = _stats.CamerasOnline + _stats.CamerasOffline + (_stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline); - total = total > 0 ? total : 1; - _cameraStatusData = - [ - new("En ligne", _stats.CamerasOnline, Color.Success, (int)(_stats.CamerasOnline * 100.0 / total)), - new("Hors ligne", _stats.CamerasOffline, Color.Error, (int)(_stats.CamerasOffline * 100.0 / total)), - new("Autre", _stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline, Color.Default, (int)((_stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline) * 100.0 / total)), - ]; - } + UpdateCameraStatusData(); // Sites var sitesResult = await Api.GetSitesAsync(1, 5); @@ -370,13 +357,13 @@ finally { _loading = false; } } - private static string FormatEventType(string type) => type switch + private string FormatEventType(string type) => type switch { - "MotionDetected" => "Mouvement", - "PersonDetected" => "Personne", - "VehicleDetected" => "Véhicule", - "FaceRecognized" => "Visage", - "CameraOffline" => "Hors ligne", + "MotionDetected" => Text["MotionDetected"], + "PersonDetected" => Text["PersonDetected"], + "VehicleDetected" => Text["VehicleDetected"], + "FaceRecognized" => Text["FaceRecognized"], + "CameraOffline" => Text["CameraOffline"], _ => type }; @@ -391,9 +378,30 @@ private record CameraStatusEntry(string Label, int Count, Color Color, int Percent); + private void UpdateCameraStatusData() + { + if (_stats is null) return; + + var other = _stats.TotalCameras - _stats.CamerasOnline - _stats.CamerasOffline; + var total = Math.Max(_stats.TotalCameras, 1); + _cameraStatusData = + [ + new(Text["Online"], _stats.CamerasOnline, Color.Success, (int)(_stats.CamerasOnline * 100.0 / total)), + new(Text["Offline"], _stats.CamerasOffline, Color.Error, (int)(_stats.CamerasOffline * 100.0 / total)), + new(Text["Other"], other, Color.Default, (int)(other * 100.0 / total)), + ]; + } + + private void OnLanguageChanged() + { + UpdateCameraStatusData(); + _ = InvokeAsync(StateHasChanged); + } + public void Dispose() { _disposed = true; + Language.LanguageChanged -= OnLanguageChanged; _refreshCts?.Cancel(); _refreshCts?.Dispose(); } diff --git a/src/Heimdall.Web/Components/Pages/Profile.razor b/src/Heimdall.Web/Components/Pages/Profile.razor index eac2f3e..6e7aa31 100644 --- a/src/Heimdall.Web/Components/Pages/Profile.razor +++ b/src/Heimdall.Web/Components/Pages/Profile.razor @@ -1,15 +1,19 @@ @page "/profile" @attribute [Authorize] @layout MainLayout +@implements IDisposable @using Enable2faResponse = Heimdall.Application.DTOs.Enable2faResponse @inject HeimdallApiClient Api @inject AuthState Auth +@inject UiLanguageService Language +@inject UiText Text @inject ISnackbar Snackbar @inject HeimdallAuthStateProvider AuthProvider +@inject IJSRuntime JS - Mon profil + @Text["Profile"] @if (_loading) @@ -19,9 +23,9 @@ else if (_error) { - Erreur lors du chargement du profil. + @Text["ProfileLoadFailed"] - Réessayer + @Text["Retry"] } @@ -31,7 +35,7 @@ else if (_profile is not null) - Informations personnelles + @Text["PersonalInformation"] @if (!string.IsNullOrEmpty(_profileError)) @@ -40,29 +44,29 @@ else if (_profile is not null) }
- - Email + @Text["Email"] @_profile.Email - Thème - - Auto - Light - Dark + @Text["Theme"] + + @Text["Auto"] + @Text["Light"] + @Text["Dark"] - Langue - - Français - English + @Text["Language"] + + @Text["French"] + @Text["English"] @if (_saving) { } - Enregistrer + @Text["Save"]
@@ -76,30 +80,30 @@ else if (_profile is not null) - Date d'inscription - @_profile.CreatedAt.ToString("g") + @Text["RegisteredAt"] + @_profile.CreatedAt.ToString("g", Language.Culture) - Email confirmé + @Text["EmailConfirmed"] - @(_profile.EmailConfirmed ? "Oui" : "Non") + @(_profile.EmailConfirmed ? Text["Yes"] : Text["No"]) - 2FA + @Text["TwoFactor"] - @(_profile.TwoFactorEnabled ? "Activé" : "Désactivé") + @(_profile.TwoFactorEnabled ? Text["TwoFactorEnabled"] : Text["TwoFactorDisabled"]) @if (_profile.TwoFactorEnabled) { @if (_toggling2fa) { } - Désactiver la 2FA + @Text["DisableTwoFactor"] } else @@ -107,12 +111,12 @@ else if (_profile is not null) @if (_toggling2fa) { } - Activer la 2FA + @Text["EnableTwoFactor"] } - Rôles + @Text["Roles"] @if (_profile.Roles is not null && _profile.Roles.Count > 0) { @@ -126,7 +130,7 @@ else if (_profile is not null) } else { - Aucun rôle + @Text["NoRoles"] } @@ -137,7 +141,7 @@ else if (_profile is not null) - Changer le mot de passe + @Text["ChangePassword"] @if (!string.IsNullOrEmpty(_passwordError)) @@ -146,21 +150,21 @@ else if (_profile is not null) }
- - - @if (_changingPassword) { } - Changer le mot de passe + @Text["ChangePassword"]
@@ -169,7 +173,7 @@ else if (_profile is not null) - Notifications + @Text["Notifications"] @if (!string.IsNullOrEmpty(_notifError)) @@ -179,45 +183,43 @@ else if (_profile is not null) - Les notifications push utilisent ntfy (serveur auto-hébergé). - Installez l'app ntfy et abonnez-vous au topic ci-dessous pour recevoir les notifications. + @Text["PushSetupInstructions"] - Votre topic : @(!string.IsNullOrWhiteSpace(_ntfyTopic) ? _ntfyTopic : $"heimdall_{_profile?.Id}") + @Text["YourTopic"] @(!string.IsNullOrWhiteSpace(_ntfyTopic) ? _ntfyTopic : $"heimdall_{_profile?.Id}") - Personnalisez le champ "Topic ntfy" ci-dessous pour utiliser un topic différent. + @Text["CustomizeTopic"] - Canal Email - - @Text["EmailChannel"] + + - Canal Push (ntfy) - - @Text["PushChannel"] + + - + + HelperText="@Text["CustomizeTopicHelper"]" /> - Résumés - - + @Text["Summaries"] + + - Types d'événements + @Text["EventTypes"] - Sélectionnez les types d'événements pour lesquels vous souhaitez recevoir des notifications push et email. - Si aucun n'est sélectionné, tous les événements sont notifiés. + @Text["SelectNotificationEventTypes"] @Text["AllEventsIfNone"] - @foreach (var et in _eventTypes) + @foreach (var et in EventTypes) { @if (_savingNotif) { } - Enregistrer + @Text["Save"]
- @(_testingNtfy ? "Test en cours…" : "Tester ntfy") + @(_testingNtfy ? Text["TestRunning"] : Text["TestNtfy"])
@if (_ntfyTestResult is not null) @@ -258,7 +260,7 @@ else if (_profile is not null) - Activer la double authentification (2FA) + @Text["EnableTwoFactor"] @@ -270,16 +272,15 @@ else if (_profile is not null) { - Scannez le code QR avec votre application d'authentification (Google Authenticator, Authy…) - ou saisissez la clé manuellement. + @Text["ScanQrInstructions"] - Clé : @_2faSetup.SharedKey + @Text["TwoFactorKey"] @_2faSetup.SharedKey @if (!string.IsNullOrEmpty(_2faSetup.QrCodeUri)) { - Lien de configuration : ouvrir dans l'app + @Text["SetupLink"] @Text["OpenInApp"] } @@ -288,9 +289,8 @@ else if (_profile is not null) { - Codes de récupération — conservez-les précieusement. - Ils permettent de vous connecter si vous perdez votre application d'authentification. - Chaque code ne peut être utilisé qu'une seule fois. + @Text["RecoveryCodes"] — @Text["KeepRecoveryCodes"] + @Text["RecoveryCodesInstructions"] @Text["RecoveryCodeOneUse"] @@ -303,12 +303,12 @@ else if (_profile is not null) } - + } } - Fermer + @Text["Close"] @@ -340,6 +340,7 @@ else if (_profile is not null) protected override async Task OnInitializedAsync() { + Language.LanguageChanged += OnLanguageChanged; await LoadProfile(); await LoadNotificationConfig(); } @@ -356,12 +357,13 @@ else if (_profile is not null) _profile = result; _displayName = result.DisplayName; _theme = result.Theme ?? "Auto"; - _language = result.Language; + _language = UiLanguageService.Normalize(result.Language); + Language.SetLanguage(_language); } } catch { _error = true; - Snackbar.Add(UiErrors.OperationFailed(), Severity.Error); + Snackbar.Add(Text["OperationFailed"], Severity.Error); } finally { _loading = false; } } @@ -372,7 +374,7 @@ else if (_profile is not null) { if (string.IsNullOrWhiteSpace(_displayName)) { - _profileError = "Le nom d'affichage est requis"; + _profileError = Text["DisplayNameRequired"]; return; } @@ -383,15 +385,19 @@ else if (_profile is not null) var success = await Api.UpdateMyProfileAsync(_displayName.Trim(), _theme, _language); if (success) { - Snackbar.Add("Profil mis à jour avec succès", Severity.Success); + _language = UiLanguageService.Normalize(_language); + Language.SetLanguage(_language); + try { await JS.InvokeVoidAsync("heimdallLocalization.setLanguage", _language); } + catch (JSException) { /* The saved preference still applies to this circuit. */ } + Snackbar.Add(Text["ProfileUpdated"], Severity.Success); } else { - _profileError = "Erreur lors de la mise à jour du profil"; + _profileError = Text["ProfileUpdateFailed"]; } } catch { - _profileError = UiErrors.OperationFailed(); + _profileError = Text["OperationFailed"]; } finally { _saving = false; } } @@ -409,7 +415,7 @@ else if (_profile is not null) var setup = await Api.Enable2faAsync(); if (setup is null) { - _2faError = "Échec de l'activation de la 2FA. Réessayez."; + _2faError = Text["OperationFailed"]; _show2faDialog = true; return; } @@ -418,7 +424,7 @@ else if (_profile is not null) } catch { - _2faError = UiErrors.OperationFailed(); + _2faError = Text["OperationFailed"]; _show2faDialog = true; } finally @@ -436,16 +442,16 @@ else if (_profile is not null) var ok = await Api.Disable2faAsync(); if (ok) { - Snackbar.Add("Double authentification désactivée", Severity.Success); + Snackbar.Add(Text["TwoFactorDisabled"], Severity.Success); } else { - Snackbar.Add("Échec de la désactivation de la 2FA", Severity.Error); + Snackbar.Add(Text["TwoFactorDisableFailed"], Severity.Error); } } catch { - Snackbar.Add(UiErrors.OperationFailed(), Severity.Error); + Snackbar.Add(Text["OperationFailed"], Severity.Error); } finally { @@ -458,22 +464,22 @@ else if (_profile is not null) { if (string.IsNullOrWhiteSpace(_currentPassword)) { - _passwordError = "Le mot de passe actuel est requis"; + _passwordError = Text["CurrentPasswordRequired"]; return; } if (string.IsNullOrWhiteSpace(_newPassword)) { - _passwordError = "Le nouveau mot de passe est requis"; + _passwordError = Text["NewPasswordRequired"]; return; } if (_newPassword.Length < 12) { - _passwordError = "Le nouveau mot de passe doit contenir au moins 12 caractères"; + _passwordError = Text["PasswordTooShort"]; return; } if (_newPassword != _confirmPassword) { - _passwordError = "Les mots de passe ne correspondent pas"; + _passwordError = Text["PasswordsMismatch"]; return; } @@ -487,15 +493,15 @@ else if (_profile is not null) _currentPassword = ""; _newPassword = ""; _confirmPassword = ""; - Snackbar.Add("Mot de passe changé avec succès", Severity.Success); + Snackbar.Add(Text["PasswordChanged"], Severity.Success); } else { - _passwordError = "Erreur lors du changement de mot de passe. Vérifiez votre mot de passe actuel."; + _passwordError = Text["PasswordChangeFailed"]; } } catch { - _passwordError = UiErrors.OperationFailed(); + _passwordError = Text["OperationFailed"]; } finally { _changingPassword = false; } } @@ -516,21 +522,25 @@ else if (_profile is not null) private TestActionResult? _ntfyTestResult; // Event type subscription checkboxes - private readonly List _eventTypes = new() - { - new("MotionDetected", "Mouvement détecté", Icons.Material.Filled.NearMe), - new("PersonDetected", "Personne détectée", Icons.Material.Filled.Person), - new("VehicleDetected", "Véhicule détecté", Icons.Material.Filled.DirectionsCar), - new("UnknownPerson", "Personne inconnue", Icons.Material.Filled.HelpOutline), - new("FaceRecognized", "Visage reconnu", Icons.Material.Filled.Face), - new("LicensePlateDetected", "Plaque détectée", Icons.Material.Filled.Pin), - new("CameraOffline", "Caméra hors ligne", Icons.Material.Filled.VideocamOff), - new("CameraOnline", "Caméra en ligne", Icons.Material.Filled.Videocam), - }; + private IReadOnlyList EventTypes => + [ + new("MotionDetected", Text["MotionDetected"], Icons.Material.Filled.NearMe), + new("PersonDetected", Text["PersonDetected"], Icons.Material.Filled.Person), + new("VehicleDetected", Text["VehicleDetected"], Icons.Material.Filled.DirectionsCar), + new("UnknownPerson", Text["UnknownPerson"], Icons.Material.Filled.HelpOutline), + new("FaceRecognized", Text["FaceRecognized"], Icons.Material.Filled.Face), + new("LicensePlateDetected", Text["LicensePlateDetected"], Icons.Material.Filled.Pin), + new("CameraOffline", Text["CameraOffline"], Icons.Material.Filled.VideocamOff), + new("CameraOnline", Text["CameraOnline"], Icons.Material.Filled.Videocam), + ]; private HashSet _subscribedEvents = new(); private sealed record EventTypeOption(string Value, string Label, string Icon); + private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged); + + public void Dispose() => Language.LanguageChanged -= OnLanguageChanged; + private void ToggleEventType(string value, bool selected) { if (selected) @@ -558,9 +568,9 @@ else if (_profile is not null) : new HashSet(); } } - catch (Exception ex) + catch (Exception) { - _notifError = $"Erreur chargement config notifications : {ex.Message}"; + _notifError = Text["NotificationConfigLoadFailed"]; } } @@ -583,15 +593,15 @@ else if (_profile is not null) var success = await Api.UpdateNotificationConfigAsync(request); if (success) { - Snackbar.Add("Configuration notifications mise à jour", Severity.Success); + Snackbar.Add(Text["NotificationConfigUpdated"], Severity.Success); } else { - _notifError = "Erreur lors de la mise à jour"; + _notifError = Text["NotificationConfigUpdateFailed"]; } } catch { - _notifError = UiErrors.OperationFailed(); + _notifError = Text["OperationFailed"]; } finally { _savingNotif = false; } } @@ -612,11 +622,11 @@ else if (_profile is not null) var topic = ResolveNtfyTopic(); var baseUrl = string.IsNullOrWhiteSpace(_ntfyUrl) ? null : _ntfyUrl.Trim(); _ntfyTestResult = await Api.TestNtfyAsync(topic, baseUrl) - ?? new TestActionResult(false, "Test impossible (API indisponible)."); + ?? new TestActionResult(false, Text["TestUnavailable"]); } - catch (Exception ex) + catch (Exception) { - _ntfyTestResult = new TestActionResult(false, $"Test impossible : {ex.Message}"); + _ntfyTestResult = new TestActionResult(false, Text["OperationFailed"]); } finally { diff --git a/src/Heimdall.Web/Localization/SharedResources.cs b/src/Heimdall.Web/Localization/SharedResources.cs new file mode 100644 index 0000000..b56a9b2 --- /dev/null +++ b/src/Heimdall.Web/Localization/SharedResources.cs @@ -0,0 +1,4 @@ +namespace Heimdall.Web; + +/// Marker type for shared UI localization resources. +public sealed class SharedResources { } diff --git a/src/Heimdall.Web/Localization/SharedResources.en.resx b/src/Heimdall.Web/Localization/SharedResources.en.resx index 4ec07f6..95160c0 100644 --- a/src/Heimdall.Web/Localization/SharedResources.en.resx +++ b/src/Heimdall.Web/Localization/SharedResources.en.resx @@ -345,4 +345,370 @@ Timestamp + + Skip to main content + + + Search... + + + Menu + + + Toggle theme + + + Log out + + + Navigation + + + Sites and cameras + + + Snapshots + + + People + + + Administration + + + User management + + + Groups + + + Roles and permissions + + + Permission matrix + + + Audit log + + + Sign in + + + Error loading the profile. + + + Retry + + + Registration date + + + Email confirmed + + + Yes + + + No + + + No roles + + + Change password + + + Current password + + + New password + + + Confirm password + + + Minimum 12 characters + + + Push notifications use ntfy (self-hosted server). Install the ntfy app and subscribe to the topic below to receive notifications. + + + Your topic: + + + Change the “ntfy topic” field below to use a different topic. + + + Email channel + + + Notification email address + + + Push channel (ntfy) + + + ntfy server URL (optional) + + + http://ntfy:80 (default) + + + Leave blank to use the global server + + + ntfy topic (optional) + + + Customize the receiving topic. Default: heimdall_{your-id} + + + Summaries + + + Daily summary (8 am) + + + Weekly summary (Monday 8 am) + + + Event types + + + Select the event types for which you want to receive push and email notifications. + + + If none are selected, all events are notified. + + + Testing… + + + Test ntfy + + + Profile updated successfully + + + Error updating the profile + + + Two-factor authentication (2FA) + + + Enabled + + + Disabled + + + Disable 2FA + + + Enable 2FA + + + Failed to disable 2FA + + + Password changed successfully + + + Could not change password. Check your current password. + + + Current password is required + + + New password is required + + + The new password must contain at least 12 characters + + + Passwords do not match + + + Notification settings updated + + + Error updating notification settings + + + Error loading notification settings + + + Test unavailable (API not available). + + + Test failed: {0} + + + Scan the QR code with your authenticator app (Google Authenticator, Authy…) or enter the key manually. + + + Key: + + + Setup link: + + + open in app + + + Recovery codes + + + Keep them safe. + + + They let you sign in if you lose access to your authenticator app. + + + Each code can only be used once. + + + I saved my recovery codes + + + Close + + + Profile unavailable + + + Welcome, + + + Last updated: + + + Cameras + + + Agents online + + + Events (24 h) + + + View all → + + + Manage → + + + Camera status + + + Count + + + Time + + + Type + + + No recent events. + + + Agent load + + + All agents → + + + No agents registered. + + + Quick actions + + + New site + + + Audit + + + Name + + + Created + + + Inactive + + + No site configured + + + Start by creating a site to deploy your monitoring agents. + + + Refresh + + + Motion + + + Person + + + Vehicle + + + Face + + + Offline + + + Other + + + {0} online + + + {0} offline + + + {0} total + + + Agents + + + Events (24 h) + + + Agents online + + + total + + + No site configured + + + Refresh dashboard + + + Automatic + + + Light + + + Dark + + + Unknown person + + + License plate detected + + + Camera online + \ No newline at end of file diff --git a/src/Heimdall.Web/Localization/SharedResources.fr.resx b/src/Heimdall.Web/Localization/SharedResources.fr.resx index 9d3f174..4839e39 100644 --- a/src/Heimdall.Web/Localization/SharedResources.fr.resx +++ b/src/Heimdall.Web/Localization/SharedResources.fr.resx @@ -345,4 +345,370 @@ Horodatage + + Aller au contenu principal + + + Rechercher... + + + Menu + + + Basculer le thème + + + Déconnexion + + + Navigation + + + Sites et caméras + + + Captures + + + Personnes + + + Administration + + + Gestion des utilisateurs + + + Groupes + + + Rôles et permissions + + + Matrice des permissions + + + Journal d’audit + + + Connexion + + + Erreur lors du chargement du profil. + + + Réessayer + + + Date d’inscription + + + Email confirmé + + + Oui + + + Non + + + Aucun rôle + + + Changer le mot de passe + + + Mot de passe actuel + + + Nouveau mot de passe + + + Confirmer le mot de passe + + + Minimum 12 caractères + + + Les notifications push utilisent ntfy (serveur auto-hébergé). Installez l’app ntfy et abonnez-vous au topic ci-dessous pour recevoir les notifications. + + + Votre topic : + + + Personnalisez le champ « Topic ntfy » ci-dessous pour utiliser un topic différent. + + + Canal email + + + Adresse email de notification + + + Canal push (ntfy) + + + URL du serveur ntfy (optionnel) + + + http://ntfy:80 (défaut) + + + Laisser vide pour utiliser le serveur global + + + Topic ntfy (optionnel) + + + Personnalisez le topic de réception. Défaut : heimdall_{votre-id} + + + Résumés + + + Résumé quotidien (8h) + + + Résumé hebdomadaire (lundi 8h) + + + Types d’événements + + + Sélectionnez les types d’événements pour lesquels vous souhaitez recevoir des notifications push et email. + + + Si aucun n’est sélectionné, tous les événements sont notifiés. + + + Test en cours… + + + Tester ntfy + + + Profil mis à jour avec succès + + + Erreur lors de la mise à jour du profil + + + Double authentification (2FA) + + + Activée + + + Désactivée + + + Désactiver la 2FA + + + Activer la 2FA + + + Échec de la désactivation de la 2FA + + + Mot de passe changé avec succès + + + Erreur lors du changement de mot de passe. Vérifiez votre mot de passe actuel. + + + Le mot de passe actuel est requis + + + Le nouveau mot de passe est requis + + + Le nouveau mot de passe doit contenir au moins 12 caractères + + + Les mots de passe ne correspondent pas + + + Configuration des notifications mise à jour + + + Erreur lors de la mise à jour + + + Erreur lors du chargement de la configuration des notifications + + + Test impossible (API indisponible). + + + Échec du test : {0} + + + Scannez le code QR avec votre application d’authentification (Google Authenticator, Authy…) ou saisissez la clé manuellement. + + + Clé : + + + Lien de configuration : + + + ouvrir dans l’app + + + Codes de récupération + + + Conservez-les précieusement. + + + Ils permettent de vous connecter si vous perdez votre application d’authentification. + + + Chaque code ne peut être utilisé qu’une seule fois. + + + J’ai sauvegardé mes codes de récupération + + + Fermer + + + Profil indisponible + + + Bienvenue, + + + Dernière mise à jour : + + + Caméras + + + Agents en ligne + + + Événements (24 h) + + + Voir tout → + + + Gérer → + + + État des caméras + + + Nombre + + + Heure + + + Type + + + Aucun événement récent. + + + Charge des agents + + + Tous les agents → + + + Aucun agent enregistré. + + + Actions rapides + + + Nouveau site + + + Audit + + + Nom + + + Créé le + + + Inactif + + + Aucun site configuré + + + Commencez par créer un site pour déployer vos agents de surveillance. + + + Rafraîchir + + + Mouvement + + + Personne + + + Véhicule + + + Visage + + + Hors ligne + + + Autre + + + {0} en ligne + + + {0} hors ligne + + + {0} total + + + Agents + + + Événements (24 h) + + + Agents en ligne + + + au total + + + Aucun site configuré + + + Actualiser le tableau de bord + + + Automatique + + + Clair + + + Sombre + + + Personne inconnue + + + Plaque détectée + + + Caméra en ligne + \ No newline at end of file diff --git a/src/Heimdall.Web/Program.cs b/src/Heimdall.Web/Program.cs index 1391ad0..3db3f9e 100644 --- a/src/Heimdall.Web/Program.cs +++ b/src/Heimdall.Web/Program.cs @@ -420,6 +420,8 @@ public partial class Program Console.WriteLine($"[DIAG] Demo seeding: {(builder.Configuration.GetValue("Seed:DemoOnStartup", false) ? "enabled" : "disabled (set Seed:DemoOnStartup=true to enable)")}"); builder.Services.AddLocalization(options => options.ResourcesPath = "Localization"); + builder.Services.AddScoped(); + builder.Services.AddScoped(); builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); diff --git a/src/Heimdall.Web/Services/UiLanguageService.cs b/src/Heimdall.Web/Services/UiLanguageService.cs new file mode 100644 index 0000000..5ee4621 --- /dev/null +++ b/src/Heimdall.Web/Services/UiLanguageService.cs @@ -0,0 +1,60 @@ +using System.Globalization; +using Heimdall.Web; +using Microsoft.Extensions.Localization; + +namespace Heimdall.Web.Services; + +/// Stores the active UI language for the current Blazor circuit. +public sealed class UiLanguageService +{ + private string _language = Normalize(CultureInfo.CurrentUICulture.Name); + + public event Action? LanguageChanged; + + public string Language => _language; + + public CultureInfo Culture => CultureInfo.GetCultureInfo(_language); + + public void SetLanguage(string? language) + { + var normalized = Normalize(language); + if (string.Equals(_language, normalized, StringComparison.Ordinal)) return; + + _language = normalized; + LanguageChanged?.Invoke(); + } + + public static string Normalize(string? language) + { + var value = language?.Trim(); + if (string.IsNullOrEmpty(value)) return "fr"; + + if (value.Equals("fr", StringComparison.OrdinalIgnoreCase) + || value.StartsWith("fr-", StringComparison.OrdinalIgnoreCase)) return "fr"; + if (value.Equals("en", StringComparison.OrdinalIgnoreCase) + || value.StartsWith("en-", StringComparison.OrdinalIgnoreCase)) return "en"; + + return "fr"; + } +} + +/// Resolves shared resources using the current user's saved language. +public sealed class UiText(IStringLocalizer localizer, UiLanguageService language) +{ + public string this[string key] + { + get + { + var previousCulture = CultureInfo.CurrentUICulture; + try + { + CultureInfo.CurrentUICulture = language.Culture; + return localizer[key].Value; + } + finally + { + CultureInfo.CurrentUICulture = previousCulture; + } + } + } +} diff --git a/src/Heimdall.Web/wwwroot/js/localization.js b/src/Heimdall.Web/wwwroot/js/localization.js new file mode 100644 index 0000000..45a7f30 --- /dev/null +++ b/src/Heimdall.Web/wwwroot/js/localization.js @@ -0,0 +1,10 @@ +window.heimdallLocalization = { + setLanguage: function (language) { + const normalized = language === "en" ? "en" : "fr"; + const value = encodeURIComponent(`c=${normalized}|uic=${normalized}`); + const secure = window.location.protocol === "https:" ? "; Secure" : ""; + + document.documentElement.lang = normalized; + document.cookie = `.AspNetCore.Culture=${value}; path=/; SameSite=Lax${secure}`; + } +}; diff --git a/todo.md b/todo.md index c0f946c..b9fa682 100644 --- a/todo.md +++ b/todo.md @@ -43,7 +43,7 @@ Ce fichier remplace les rapports de `docs/audits/` et constitue le suivi courant - [x] **Inventaire #86** La PR #84 livre les échantillons Central idempotents toutes les 5 min, l’horodatage distinct de réception, les agrégats API bornés (5 min/30 min) avec trous conservés, l’historique agent, la capacité par site, les graphiques 24 h/7 j, l’index et la purge en lots à 8 jours. La migration, les tests et scans d’images ont passé dans le run PR #273. Les températures GPU sont disponibles lorsque l’Agent remonte un inventaire GPU. - [ ] **mDNS #81** La PR #78 fait de l'Agent la source unique des probes HomeKit sur le LAN caméra ; Central persiste et restitue catégorie, appairage et port, et la fusion conserve l'annonce mDNS même si le scan TCP a vu l'IP d'abord. Le client partagé assemble PTR/SRV/TXT/A, décode `ci` et `sf`, et filtre les catégories 17/18. La CI #246 a passé build, tests et scans d'images ; reste une validation sur LAN avec caméra/sonnette réelles. - [ ] **UI groupes #138 / accès #134** L'édition des groupes permet maintenant de lister les caméras des sites, d'accorder/révoquer les accès de groupe et d'afficher les noms de site/caméra via l'API existante. Restent la validation produit et la vérification de l'union accès direct/groupe ainsi que des priorités dans l'interface. -- [ ] **Localisation #142** Extraire tous les textes UI, erreurs, notifications et emails ; persister FR/EN par utilisateur, basculer sans rechargement, garder français par défaut et vérifier les clés des deux ressources. +- [ ] **Localisation #142** Extraire tous les textes UI, erreurs, notifications et emails ; persister FR/EN par utilisateur, basculer sans rechargement, garder français par défaut et vérifier les clés des deux ressources. Premier lot : shell, tableau de bord et profil (dont notifications du profil, erreurs et types d’événements) ; les autres pages, notifications émises et emails restent à migrer. - [ ] **Métriques #14** Les endpoints Prometheus `/metrics` Web et Agent sont mappés. La PR #68 ajoute et valide `heimdall.signalr.connections_by_hub` sur les cinq hubs Web. La jauge de viewers existe, mais aucun producteur WebRTC n'existe avant FEAT-01. Restent la validation de scraping sur un déploiement et l'évolution réelle des mesures. - [x] Ajouter `.agents/skills/secure-env-secrets/SKILL.md` : procédures pour lire/écrire les secrets fournis par l'utilisateur dans l'environnement local, avec stockage persistant optionnel hors dépôt, permissions utilisateur uniquement et sans exposer la valeur. Le skill ne configure pas les secrets des workflows distants. - [ ] Vérifier readiness et alertes pour modèle absent, file pleine, backlog, disque, jobs bloqués, perte de configuration et échec de livraison. Le contrôle stockage est aligné sur le fournisseur actif (settings DB/env), avec probe d’écriture locale, probe du bucket S3 sélectionné et timeout borné ; les health checks IA convertissent aussi leurs timeouts internes en état dégradé tout en propageant l’annulation appelante. Les scénarios réels de panne restent à valider. From c321c057dab07447aea59aaab90f34893fd58131 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 04:27:42 +0100 Subject: [PATCH 2/7] test(web): register localization services in component fixture --- tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs b/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs index af79da8..9f9b6ef 100644 --- a/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs +++ b/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs @@ -50,6 +50,9 @@ public abstract class PageTestBase : MudTestBase // ILogger (required by Login page) — silent by default Services.AddLogging(); + Services.AddLocalization(options => options.ResourcesPath = "Localization"); + Services.AddScoped(); + Services.AddScoped(); var httpClient = new HttpClient(Handler) { BaseAddress = new Uri("http://localhost/") }; var httpFactory = Substitute.For(); From 0adc204f65e9b90531b7ff1aca27b75cf06a0e2f Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 04:38:51 +0100 Subject: [PATCH 3/7] fix(i18n): default UI language to French --- src/Heimdall.Web/Services/UiLanguageService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Heimdall.Web/Services/UiLanguageService.cs b/src/Heimdall.Web/Services/UiLanguageService.cs index 5ee4621..32db33e 100644 --- a/src/Heimdall.Web/Services/UiLanguageService.cs +++ b/src/Heimdall.Web/Services/UiLanguageService.cs @@ -7,7 +7,9 @@ namespace Heimdall.Web.Services; /// Stores the active UI language for the current Blazor circuit. public sealed class UiLanguageService { - private string _language = Normalize(CultureInfo.CurrentUICulture.Name); + // French is the product default; authenticated layouts replace it with + // the language saved on the user's profile when available. + private string _language = "fr"; public event Action? LanguageChanged; From 3c28b0e27c1742a4a76864bcf70a2f8aedcdadff Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 04:49:48 +0100 Subject: [PATCH 4/7] fix(i18n): resolve embedded shared resources directly --- .../Services/UiLanguageService.cs | 22 ++++++------------- .../Components/Pages/PageTestBase.cs | 1 - 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Heimdall.Web/Services/UiLanguageService.cs b/src/Heimdall.Web/Services/UiLanguageService.cs index 32db33e..16c707e 100644 --- a/src/Heimdall.Web/Services/UiLanguageService.cs +++ b/src/Heimdall.Web/Services/UiLanguageService.cs @@ -1,6 +1,6 @@ using System.Globalization; +using System.Resources; using Heimdall.Web; -using Microsoft.Extensions.Localization; namespace Heimdall.Web.Services; @@ -41,22 +41,14 @@ public sealed class UiLanguageService } /// Resolves shared resources using the current user's saved language. -public sealed class UiText(IStringLocalizer localizer, UiLanguageService language) +public sealed class UiText(UiLanguageService language) { + private static readonly ResourceManager Resources = new( + "Heimdall.Web.Localization.SharedResources", + typeof(SharedResources).Assembly); + public string this[string key] { - get - { - var previousCulture = CultureInfo.CurrentUICulture; - try - { - CultureInfo.CurrentUICulture = language.Culture; - return localizer[key].Value; - } - finally - { - CultureInfo.CurrentUICulture = previousCulture; - } - } + get => Resources.GetString(key, language.Culture) ?? key; } } diff --git a/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs b/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs index 9f9b6ef..1a89634 100644 --- a/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs +++ b/tests/Heimdall.Web.Tests/Components/Pages/PageTestBase.cs @@ -50,7 +50,6 @@ public abstract class PageTestBase : MudTestBase // ILogger (required by Login page) — silent by default Services.AddLogging(); - Services.AddLocalization(options => options.ResourcesPath = "Localization"); Services.AddScoped(); Services.AddScoped(); From 93a6f1fa037c0689359ebd0d742207696af42b99 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 04:59:25 +0100 Subject: [PATCH 5/7] fix(i18n): add French neutral resource fallback --- .../Localization/SharedResources.resx | 714 ++++++++++++++++++ 1 file changed, 714 insertions(+) create mode 100644 src/Heimdall.Web/Localization/SharedResources.resx diff --git a/src/Heimdall.Web/Localization/SharedResources.resx b/src/Heimdall.Web/Localization/SharedResources.resx new file mode 100644 index 0000000..4839e39 --- /dev/null +++ b/src/Heimdall.Web/Localization/SharedResources.resx @@ -0,0 +1,714 @@ + + + + + Bonjour + + + Bienvenue + + + Enregistrer + + + Annuler + + + Supprimer + + + Confirmer + + + Succès + + + Erreur + + + Chargement + + + Retour + + + Suivant + + + + + Profil + + + Informations personnelles + + + Nom d'affichage + + + Thème + + + Langue + + + Français + + + English + + + + + Notifications + + + Notifications par email + + + Notifications push (ntfy) + + + + + L'opération a échoué + + + Le nom d'affichage est requis + + + L'email est requis + + + + Sites + + + Site + + + Nom du site + + + Adresse + + + Fuseau horaire + + + Créer un site + + + Modifier le site + + + Supprimer le site + + + Token d'enregistrement + + + Générer un token + + + + Caméras + + + Caméra + + + Nom de la caméra + + + Fabricant + + + Modèle + + + URL RTSP + + + Découverte ONVIF + + + Zones de détection + + + Modèle YOLO + + + Seuil de confiance + + + Flux en direct + + + Statut caméra + + + En ligne + + + Hors ligne + + + Désactivée + + + + Utilisateurs + + + Utilisateur + + + Email + + + Rôles + + + Administrateur + + + Superviseur + + + Visiteur + + + Statut + + + Actif + + + Verrouillé + + + En attente + + + Créé le + + + Actions + + + Modifier l'utilisateur + + + Supprimer l'utilisateur + + + Verrouiller + + + Déverrouiller + + + Réinitialiser le mot de passe + + + Confirmer l'email + + + Accès caméras + + + + Paramètres + + + Stockage + + + Intégrations + + + Configuration ntfy + + + Configuration Email + + + Configuration IA + + + Défauts agents + + + Tester la connexion + + + Fournisseur + + + Local + + + S3 + + + Chemin + + + Bucket + + + Clé d'accès + + + Clé secrète + + + Région + + + Endpoint + + + Serveur SMTP + + + Port SMTP + + + Utilisateur + + + Mot de passe + + + Utiliser SSL/TLS + + + Adresse expéditrice + + + Nom expéditeur + + + URL CodeProject.AI + + + URL Ollama + + + Détection activée + + + Niveau de log + + + Rétention logs (jours) + + + Intervalle heartbeat (s) + + + + Tableau de bord + + + Total sites + + + Total caméras + + + Total agents + + + Total événements + + + Événements + + + Événements récents + + + Personne + + + Véhicule + + + Plaque + + + Confiance + + + Horodatage + + + Aller au contenu principal + + + Rechercher... + + + Menu + + + Basculer le thème + + + Déconnexion + + + Navigation + + + Sites et caméras + + + Captures + + + Personnes + + + Administration + + + Gestion des utilisateurs + + + Groupes + + + Rôles et permissions + + + Matrice des permissions + + + Journal d’audit + + + Connexion + + + Erreur lors du chargement du profil. + + + Réessayer + + + Date d’inscription + + + Email confirmé + + + Oui + + + Non + + + Aucun rôle + + + Changer le mot de passe + + + Mot de passe actuel + + + Nouveau mot de passe + + + Confirmer le mot de passe + + + Minimum 12 caractères + + + Les notifications push utilisent ntfy (serveur auto-hébergé). Installez l’app ntfy et abonnez-vous au topic ci-dessous pour recevoir les notifications. + + + Votre topic : + + + Personnalisez le champ « Topic ntfy » ci-dessous pour utiliser un topic différent. + + + Canal email + + + Adresse email de notification + + + Canal push (ntfy) + + + URL du serveur ntfy (optionnel) + + + http://ntfy:80 (défaut) + + + Laisser vide pour utiliser le serveur global + + + Topic ntfy (optionnel) + + + Personnalisez le topic de réception. Défaut : heimdall_{votre-id} + + + Résumés + + + Résumé quotidien (8h) + + + Résumé hebdomadaire (lundi 8h) + + + Types d’événements + + + Sélectionnez les types d’événements pour lesquels vous souhaitez recevoir des notifications push et email. + + + Si aucun n’est sélectionné, tous les événements sont notifiés. + + + Test en cours… + + + Tester ntfy + + + Profil mis à jour avec succès + + + Erreur lors de la mise à jour du profil + + + Double authentification (2FA) + + + Activée + + + Désactivée + + + Désactiver la 2FA + + + Activer la 2FA + + + Échec de la désactivation de la 2FA + + + Mot de passe changé avec succès + + + Erreur lors du changement de mot de passe. Vérifiez votre mot de passe actuel. + + + Le mot de passe actuel est requis + + + Le nouveau mot de passe est requis + + + Le nouveau mot de passe doit contenir au moins 12 caractères + + + Les mots de passe ne correspondent pas + + + Configuration des notifications mise à jour + + + Erreur lors de la mise à jour + + + Erreur lors du chargement de la configuration des notifications + + + Test impossible (API indisponible). + + + Échec du test : {0} + + + Scannez le code QR avec votre application d’authentification (Google Authenticator, Authy…) ou saisissez la clé manuellement. + + + Clé : + + + Lien de configuration : + + + ouvrir dans l’app + + + Codes de récupération + + + Conservez-les précieusement. + + + Ils permettent de vous connecter si vous perdez votre application d’authentification. + + + Chaque code ne peut être utilisé qu’une seule fois. + + + J’ai sauvegardé mes codes de récupération + + + Fermer + + + Profil indisponible + + + Bienvenue, + + + Dernière mise à jour : + + + Caméras + + + Agents en ligne + + + Événements (24 h) + + + Voir tout → + + + Gérer → + + + État des caméras + + + Nombre + + + Heure + + + Type + + + Aucun événement récent. + + + Charge des agents + + + Tous les agents → + + + Aucun agent enregistré. + + + Actions rapides + + + Nouveau site + + + Audit + + + Nom + + + Créé le + + + Inactif + + + Aucun site configuré + + + Commencez par créer un site pour déployer vos agents de surveillance. + + + Rafraîchir + + + Mouvement + + + Personne + + + Véhicule + + + Visage + + + Hors ligne + + + Autre + + + {0} en ligne + + + {0} hors ligne + + + {0} total + + + Agents + + + Événements (24 h) + + + Agents en ligne + + + au total + + + Aucun site configuré + + + Actualiser le tableau de bord + + + Automatique + + + Clair + + + Sombre + + + Personne inconnue + + + Plaque détectée + + + Caméra en ligne + + \ No newline at end of file From 4ac8c705a571762214f03fe42e1721da833a81cf Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 05:10:08 +0100 Subject: [PATCH 6/7] fix(i18n): match embedded resource base name --- src/Heimdall.Web/Services/UiLanguageService.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Heimdall.Web/Services/UiLanguageService.cs b/src/Heimdall.Web/Services/UiLanguageService.cs index 16c707e..68989ac 100644 --- a/src/Heimdall.Web/Services/UiLanguageService.cs +++ b/src/Heimdall.Web/Services/UiLanguageService.cs @@ -43,9 +43,7 @@ public sealed class UiLanguageService /// Resolves shared resources using the current user's saved language. public sealed class UiText(UiLanguageService language) { - private static readonly ResourceManager Resources = new( - "Heimdall.Web.Localization.SharedResources", - typeof(SharedResources).Assembly); + private static readonly ResourceManager Resources = new(typeof(SharedResources)); public string this[string key] { From 2e45c37925d71f7c9c3aef3483acfaef18d23fe1 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Sun, 25 Oct 2026 05:17:23 +0100 Subject: [PATCH 7/7] test(web): align localized page assertions --- tests/Heimdall.Web.Tests/Components/Pages/A11yPageTests.cs | 2 +- tests/Heimdall.Web.Tests/Components/Pages/DashboardTests.cs | 4 ++-- tests/Heimdall.Web.Tests/Components/Pages/ProfileTests.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Heimdall.Web.Tests/Components/Pages/A11yPageTests.cs b/tests/Heimdall.Web.Tests/Components/Pages/A11yPageTests.cs index a8c1708..eadd96a 100644 --- a/tests/Heimdall.Web.Tests/Components/Pages/A11yPageTests.cs +++ b/tests/Heimdall.Web.Tests/Components/Pages/A11yPageTests.cs @@ -39,7 +39,7 @@ public class A11yPageTests : PageTestBase LoginAs(); var cut = RenderPage(); - cut.WaitForAssertion(() => cut.Markup.ShouldContain("Dashboard")); + cut.WaitForAssertion(() => cut.Markup.ShouldContain("Tableau de bord")); cut.FindAll("h1").Count.ShouldBe(1); // Le titre de page est le seul h1 ; les compteurs de stats restent des h4 diff --git a/tests/Heimdall.Web.Tests/Components/Pages/DashboardTests.cs b/tests/Heimdall.Web.Tests/Components/Pages/DashboardTests.cs index 44c2bea..dee3117 100644 --- a/tests/Heimdall.Web.Tests/Components/Pages/DashboardTests.cs +++ b/tests/Heimdall.Web.Tests/Components/Pages/DashboardTests.cs @@ -67,7 +67,7 @@ public class DashboardTests : PageTestBase { cut.Markup.ShouldContain("Caméras"); cut.Markup.ShouldContain("Agents en ligne"); - cut.Markup.ShouldContain("Événements (24h)"); + cut.Markup.ShouldContain("Événements (24 h)"); cut.Markup.ShouldContain("Sites"); cut.Markup.ShouldContain("42"); cut.Markup.ShouldContain("7"); @@ -112,7 +112,7 @@ public class DashboardTests : PageTestBase cut.WaitForAssertion(() => { - cut.Markup.ShouldContain("Derniers événements"); + cut.Markup.ShouldContain("Événements récents"); cut.Markup.ShouldContain("Personne"); cut.Markup.ShouldContain("87%"); }); diff --git a/tests/Heimdall.Web.Tests/Components/Pages/ProfileTests.cs b/tests/Heimdall.Web.Tests/Components/Pages/ProfileTests.cs index 960c3e9..d333cef 100644 --- a/tests/Heimdall.Web.Tests/Components/Pages/ProfileTests.cs +++ b/tests/Heimdall.Web.Tests/Components/Pages/ProfileTests.cs @@ -47,13 +47,13 @@ public class ProfileTests : PageTestBase cut.WaitForAssertion(() => { - cut.Markup.ShouldContain("Mon profil"); + cut.Markup.ShouldContain("Profil"); cut.Markup.ShouldContain("Jean Dupont"); cut.Markup.ShouldContain("jean@heimdall.local"); cut.Markup.ShouldContain("Informations personnelles"); cut.Markup.ShouldContain("Changer le mot de passe"); cut.Markup.ShouldContain("Notifications"); - cut.Markup.ShouldContain("Activé"); // 2FA + cut.Markup.ShouldContain("Activée"); // 2FA cut.Markup.ShouldContain("Oui"); // Email confirmé }); } @@ -185,7 +185,7 @@ public class ProfileTests : PageTestBase { var snackbar = Services.GetRequiredService(); snackbar.ShownSnackbars.Select(m => m.Message?.ToString() ?? "") - .ShouldContain(m => m.Contains("Configuration notifications mise à jour", StringComparison.OrdinalIgnoreCase)); + .ShouldContain(m => m.Contains("Configuration des notifications mise à jour", StringComparison.OrdinalIgnoreCase)); }); } }