i18n on the web - deepseek translations
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use askama::Template;
|
||||
|
||||
use crate::{i18n::Locale, tr};
|
||||
use crate::ui::{Alert, Nav, render};
|
||||
|
||||
use super::state::AddLogicPageState;
|
||||
@@ -20,15 +21,28 @@ pub(crate) fn render_page(page: &AddLogicPageState) -> String {
|
||||
}
|
||||
|
||||
/// POST /admin/logic — the #submission-status swaps.
|
||||
pub(crate) fn render_submission_error(message: &str) -> String {
|
||||
render(&Alert::error("Could not save the logic", message))
|
||||
pub(crate) fn render_submission_error(locale: Locale, message: &str) -> String {
|
||||
render(&Alert::error(
|
||||
locale,
|
||||
&tr!(locale, "add-logic-error-title"),
|
||||
message,
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) fn render_success(id: i64, warnings: &str) -> String {
|
||||
pub(crate) fn render_success(locale: Locale, id: i64, warnings: &str) -> String {
|
||||
let message = if warnings.trim().is_empty() {
|
||||
format!("Script #{id} was saved.")
|
||||
tr!(locale, "add-logic-saved", "id" => id.to_string())
|
||||
} else {
|
||||
format!("Script #{id} was saved. Warnings: {warnings}")
|
||||
tr!(
|
||||
locale,
|
||||
"add-logic-saved-warnings",
|
||||
"id" => id.to_string(),
|
||||
"warnings" => warnings.to_string(),
|
||||
)
|
||||
};
|
||||
render(&Alert::success("Logic saved", &message))
|
||||
render(&Alert::success(
|
||||
locale,
|
||||
&tr!(locale, "add-logic-success-title"),
|
||||
&message,
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user