diff --git a/backend/src/services/mod.rs b/backend/src/services/mod.rs
index 3d6e9f0..8861ef4 100644
--- a/backend/src/services/mod.rs
+++ b/backend/src/services/mod.rs
@@ -10,11 +10,11 @@ use serde::Deserialize;
use crate::{
app::{AppState, Context, Result},
- consts,
data::db,
html_templates::*,
log::Log,
ron_utils,
+ translation::Sentence,
};
pub mod fragments;
@@ -98,7 +98,10 @@ pub async fn dev_panel(
} else {
Ok((
StatusCode::UNAUTHORIZED,
- Html(MessageTemplate::new(consts::NOT_AUTHORIZED_MESSAGE, context).render()?),
+ Html(
+ MessageTemplate::new(context.tr.t(Sentence::ActionNotAuthorized), context)
+ .render()?,
+ ),
)
.into_response())
}
@@ -145,7 +148,10 @@ pub async fn logs(
} else {
Ok((
StatusCode::UNAUTHORIZED,
- Html(MessageTemplate::new(consts::NOT_AUTHORIZED_MESSAGE, context).render()?),
+ Html(
+ MessageTemplate::new(context.tr.t(Sentence::ActionNotAuthorized), context)
+ .render()?,
+ ),
)
.into_response())
}
diff --git a/backend/src/services/ron/calendar.rs b/backend/src/services/ron/calendar.rs
index da1b992..4072973 100644
--- a/backend/src/services/ron/calendar.rs
+++ b/backend/src/services/ron/calendar.rs
@@ -8,10 +8,10 @@ use axum_extra::extract::Query;
use crate::{
app::Context,
- consts,
data::{self, db},
ron_extractor::ExtractRon,
ron_utils::{ron_error, ron_response_ok},
+ translation::Sentence,
};
use super::rights::*;
@@ -31,7 +31,7 @@ pub async fn get_scheduled_recipes(
} else {
Err(ErrorResponse::from(ron_error(
StatusCode::UNAUTHORIZED,
- consts::NOT_AUTHORIZED_MESSAGE,
+ context.tr.t(Sentence::ActionNotAuthorized),
)))
}
}
diff --git a/backend/src/services/ron/mod.rs b/backend/src/services/ron/mod.rs
index 742b041..b971d8b 100644
--- a/backend/src/services/ron/mod.rs
+++ b/backend/src/services/ron/mod.rs
@@ -5,7 +5,6 @@ use axum::{
response::{IntoResponse, Result},
};
use axum_extra::extract::cookie::{Cookie, CookieJar, SameSite};
-// use tracing::{event, Level};
use crate::{
app::Context, consts, data::db, data::model, ron_extractor::ExtractRon, ron_utils::ron_error,
diff --git a/backend/src/translation.rs b/backend/src/translation.rs
index 3c41e31..a28f4e6 100644
--- a/backend/src/translation.rs
+++ b/backend/src/translation.rs
@@ -25,6 +25,8 @@ pub enum Sentence {
Save,
NotLoggedIn,
+ ActionNotAuthorized,
+
DatabaseError,
TemplateError,
diff --git a/backend/templates/base_with_header.html b/backend/templates/base_with_header.html
index d27fc15..7fe0b10 100644
--- a/backend/templates/base_with_header.html
+++ b/backend/templates/base_with_header.html
@@ -12,7 +12,7 @@
{% if user.is_admin %}
LogsDev panel
{% endif %}
-
+
{% if user.name == "" %}
{{ user.email }}
{% else %}
diff --git a/backend/translation.ron b/backend/translation.ron
index 0745507..e80e67e 100644
--- a/backend/translation.ron
+++ b/backend/translation.ron
@@ -17,6 +17,8 @@
(Save, "Save"),
(NotLoggedIn, "No logged in"),
+ (ActionNotAuthorized, "Action not authorized"),
+
(DatabaseError, "Database error"),
(TemplateError, "Template error"),
@@ -165,6 +167,8 @@
(Save, "Sauvegarder"),
(NotLoggedIn, "Pas connecté"),
+ (ActionNotAuthorized, "Action non autorisée"),
+
(DatabaseError, "Erreur de la base de données (Database error)"),
(TemplateError, "Erreur du moteur de modèles (Template error)"),