Fix translations

This commit is contained in:
Adrian Woźniak 2023-10-11 13:48:38 +02:00
parent d4135d425f
commit 9329c57970
12 changed files with 117 additions and 130 deletions

View File

@ -1203,11 +1203,6 @@ select {
line-height: 1;
}
.text-blue-400 {
--tw-text-opacity: 1;
color: rgb(96 165 250 / var(--tw-text-opacity));
}
.text-emerald-500 {
--tw-text-opacity: 1;
color: rgb(16 185 129 / var(--tw-text-opacity));
@ -1305,11 +1300,6 @@ select {
transition-timing-function: linear;
}
.hover\:bg-blue-200:hover {
--tw-bg-opacity: 1;
background-color: rgb(191 219 254 / var(--tw-bg-opacity));
}
.hover\:bg-gray-100:hover {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
@ -1325,11 +1315,6 @@ select {
background-color: rgb(254 240 138 / var(--tw-bg-opacity));
}
.hover\:text-blue-900:hover {
--tw-text-opacity: 1;
color: rgb(30 58 138 / var(--tw-text-opacity));
}
.hover\:text-neutral-700:hover {
--tw-text-opacity: 1;
color: rgb(64 64 64 / var(--tw-text-opacity));
@ -1466,11 +1451,6 @@ select {
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
}
.dark\:hover\:bg-blue-800:hover {
--tw-bg-opacity: 1;
background-color: rgb(30 64 175 / var(--tw-bg-opacity));
}
.dark\:hover\:bg-gray-600:hover {
--tw-bg-opacity: 1;
background-color: rgb(75 85 99 / var(--tw-bg-opacity));
@ -1491,11 +1471,6 @@ select {
background-color: rgb(133 77 14 / var(--tw-bg-opacity));
}
.dark\:hover\:text-blue-300:hover {
--tw-text-opacity: 1;
color: rgb(147 197 253 / var(--tw-text-opacity));
}
.dark\:hover\:text-neutral-400:hover {
--tw-text-opacity: 1;
color: rgb(163 163 163 / var(--tw-text-opacity));

View File

@ -3,14 +3,17 @@ use actix_web::web::{scope, Data, Form, Path, ServiceConfig};
use actix_web::{get, post, put, HttpRequest, HttpResponse};
use askama_actix::Template;
use autometrics::autometrics;
use oswilno_contract::parking_space_locations::Model as ParkingSpaceLocation;
use oswilno_contract::parking_space_rents;
use oswilno_contract::parking_space_rents::Model as ParkingSpaceRent;
use oswilno_contract::parking_spaces;
use oswilno_contract::parking_spaces::Model as ParkingSpace;
use oswilno_contract::sea_orm_active_enums::ParkingSpaceState;
use oswilno_contract::{accounts, parking_space_locations};
use oswilno_session::{Authenticated, MaybeAuthenticated};
use oswilno_view::{
filters, is_partial, Blank, Errors, HelperContext, Lang, Layout, Main, MainOpts, SearchOpts,
SessionOpts, TranslationStorage,
filters, is_partial, Blank, Errors, HelperContext, Layout, Main, MainOpts, SearchOpts,
SessionOpts,
};
use sea_orm::prelude::*;
use sea_orm::ActiveValue::{NotSet, Set};
@ -46,6 +49,10 @@ pub fn translations(l10n: &mut oswilno_view::TranslationStorage) {
.add("Location", "Miejsce")
.add("Spot", "Miejsce postojowe")
.add("Register parking space", "Zarejestruj miejsce postojowe")
.add("Owned parking spaces", "Posiadane miejsca postojowe")
.add("Pending", "Oczekuje na akceptację")
.add("Approved", "Zaakceptowane")
.add("Rejected", "Odrzucone")
.done();
}
@ -62,8 +69,8 @@ async fn root() -> HttpResponse {
#[template(path = "../templates/parking-spaces/all-partial.html")]
struct AllPartialParkingSpace {
parking_space_rents: Vec<parking_space_rents::Model>,
parking_space_by_id: BTreeMap<i32, Rc<parking_spaces::Model>>,
parking_spaces: Vec<Rc<parking_spaces::Model>>,
parking_space_by_id: BTreeMap<i32, Rc<ParkingSpace>>,
parking_spaces: Vec<Rc<ParkingSpace>>,
account_by_id: BTreeMap<i32, accounts::Model>,
#[allow(dead_code)]
locations: Vec<Rc<parking_space_locations::Model>>,
@ -88,7 +95,7 @@ async fn all_parking_spaces(
tracing::debug!("session {session:?}");
let mut parking_spaces = load_parking_spaces(db, account_id, htx).await;
let mut parking_spaces = load_parking_spaces(db, account_id, hcx.clone()).await;
parking_spaces.session = session.clone();
let main = Main {
body: parking_spaces,
@ -101,6 +108,7 @@ async fn all_parking_spaces(
}),
..Default::default()
},
hcx: hcx.clone(),
};
HttpResponse::Ok()
.append_header(("HX-Retarget", "main"))
@ -215,7 +223,7 @@ async fn form_show(
form: Default::default(),
locations: load_locations(db.clone()).await,
errors: Default::default(),
hcx,
hcx: hcx.clone(),
};
let main = Main {
body,
@ -225,6 +233,7 @@ async fn form_show(
search: None,
session: Some(session),
},
hcx: hcx.clone(),
};
let html = if is_partial(&req) {
main.render()
@ -341,10 +350,9 @@ async fn ensure_locations(db: Arc<sea_orm::DatabaseConnection>) {
async fn edit_show(
req: HttpRequest,
session: Authenticated,
t: Data<TranslationStorage>,
lang: Lang,
db: Data<DatabaseConnection>,
id: Path<i32>,
hcx: HelperContext,
) -> HttpResponse {
let db = db.into_inner();
let id = id.into_inner();
@ -368,9 +376,8 @@ async fn edit_show(
id: Some(id),
},
locations: load_locations(db.clone()).await,
lang,
errors: Default::default(),
t: t.into_inner(),
hcx: hcx.clone(),
};
let main = Main {
body,
@ -380,6 +387,7 @@ async fn edit_show(
search: None,
session: Some(session),
},
hcx: hcx.clone(),
};
let html = if is_partial(&req) {
main.render()
@ -397,8 +405,7 @@ async fn update(
db: Data<sea_orm::DatabaseConnection>,
p: Form<CreateParkingSpace>,
session: Authenticated,
t: Data<TranslationStorage>,
lang: Lang,
hcx: HelperContext,
) -> HttpResponse {
use oswilno_contract::parking_spaces::*;
let CreateParkingSpace {
@ -442,10 +449,9 @@ async fn update(
spot,
id: Some(id),
},
t: t.into_inner(),
lang,
errors: Default::default(),
locations: load_locations(db.clone()).await,
hcx,
}
.render()
.unwrap(),
@ -469,10 +475,9 @@ struct ParkingSpaceRentForm {
#[template(path = "../templates/parking-space-rents/form.html")]
struct ParkingSpaceRentFormTemplate {
pub form: ParkingSpaceRentForm,
pub parking_space: oswilno_contract::parking_spaces::Model,
pub location: oswilno_contract::parking_space_locations::Model,
lang: Lang,
t: Arc<TranslationStorage>,
pub parking_space: ParkingSpace,
pub location: ParkingSpaceLocation,
hcx: HelperContext,
}
#[get("/{parking_space_id}/parking-space-rents/form")]
@ -481,14 +486,11 @@ async fn parking_space_rent_form(
db: Data<sea_orm::DatabaseConnection>,
session: MaybeAuthenticated,
parking_space_id: Path<i32>,
t: Data<TranslationStorage>,
lang: Lang,
hcx: HelperContext,
) -> HttpResponse {
let parking_space_id = parking_space_id.into_inner();
let db = db.into_inner();
let session = session.into_option();
let _account_id = session.as_ref().map(|s| s.account_id());
let session = session.map(Into::into);
let parking_space = {
use ::oswilno_contract::parking_spaces::{Column, Entity};
let res = Entity::find()
@ -524,27 +526,14 @@ async fn parking_space_rent_form(
}
}
};
let body = ParkingSpaceRentFormTemplate {
let html = render_rent_form(
ParkingSpaceRentForm::default(),
&req,
parking_space,
location,
form: ParkingSpaceRentForm::default(),
lang,
t: t.into_inner(),
};
let main = Main {
body,
title: Blank,
opts: MainOpts {
show: true,
search: None,
session,
},
};
let html = if is_partial(&req) {
main.render()
} else {
Layout { main }.render()
};
hcx,
);
HttpResponse::Ok()
.append_header((
"HX-Redirect",
@ -555,7 +544,7 @@ async fn parking_space_rent_form(
.as_str(),
))
.append_header(("HX-Retarget", "main"))
.body(html.unwrap())
.body(html)
}
#[get("/{parking_space_id}/parking-space-rents/edit/{id}")]
async fn parking_space_rent_edit(_id: Path<i32>) -> HttpResponse {
@ -574,13 +563,19 @@ async fn parking_space_rent_update(form: Form<ParkingSpaceRentForm>) -> HttpResp
todo!()
}
fn render_rent_form(form: ParkingSpaceRentForm, req: &HttpRequest) -> String {
fn render_rent_form(
form: ParkingSpaceRentForm,
req: &HttpRequest,
parking_space: ParkingSpace,
location: ParkingSpaceLocation,
session: MaybeAuthenticated,
hcx: HelperContext,
) -> String {
let body = ParkingSpaceRentFormTemplate {
parking_space,
location,
form,
lang,
t: t.into_inner(),
hcx: hcx.clone(),
};
let main = Main {
body,
@ -588,12 +583,14 @@ fn render_rent_form(form: ParkingSpaceRentForm, req: &HttpRequest) -> String {
opts: MainOpts {
show: true,
search: None,
session,
session: session.into_option().map(Into::into),
},
hcx: hcx.clone(),
};
if is_partial(&req) {
main.render()
} else {
Layout { main }.render()
}
.unwrap()
}

View File

@ -23,7 +23,7 @@
for="price"
class="block mb-2 text-sm text-gray-600"
>
{{ "Price"|t(lang,t) }}
{{ "Price"|t(hcx) }}
</label>
<div class="flex w-full">
<input
@ -44,9 +44,9 @@
<input
type="submit"
{% if let Some(id) = form.id %}
value="{{"Update parking space rent"|t(lang,t)}}"
value="{{"Update parking space rent"|t(hcx)}}"
{% else %}
value="{{"Register parking space rent"|t(lang,t)}}"
value="{{"Register parking space rent"|t(hcx)}}"
{% endif %}
class="w-64 bg-cyan-600 text-white py-2 rounded-lg mx-auto block focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 mb-2"
/>

View File

@ -28,7 +28,9 @@
class="w-full p-4 bg-white border border-white-200 rounded-lg shadow sm:p-8 dark:bg-white-800 dark:border-white-700 mt-6"
>
<div class="flex items-center justify-between mb-4">
<h5 class="text-xl font-bold leading-none text-gray-900 dark:text-black">Owned parking spaces</h5>
<h5 class="text-xl font-bold leading-none text-gray-900 dark:text-black">
{{"Owned parking spaces"|t(hcx)}}
</h5>
</div>
<div class="flow-root">
<ul role="list" class="divide-y divide-white-200 dark:divide-white-700">
@ -60,6 +62,7 @@
</svg>
</a>
{% endif %}
{% if parking_space.state != ParkingSpaceState::Banned %}
<a
href="/parking-spaces/edit/{{parking_space.id}}"
hx-target="main"
@ -94,6 +97,7 @@
</path>
</svg>
</a>
{% endif %}
</div>
</div>

View File

@ -1,8 +1,8 @@
<section id="main-view" class="lg:min-h-ffh xl:min-h-ffhl flex items-top justify-center">
<section class="max-w-md w-full p-6 bg-white rounded-lg shadow-lg">
<h2 class="text-xl text-gray-900 mb-2">{{ "Register parking space"|t(lang,t) }}</h2>
<h2 class="text-xl text-gray-900 mb-2">{{ "Register parking space"|t(hcx) }}</h2>
{% for error in errors.global() %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
<oswilno-error>{{error|t(hcx)}}</oswilno-error>
{% endfor %}
<form
{% if let Some(id) = form.id %}
@ -20,7 +20,7 @@
for="location_id"
class="block mb-2 text-sm text-gray-600"
>
{{ "Location"|t(lang,t) }}
{{ "Location"|t(hcx) }}
</label>
<select
id="location_id"
@ -40,7 +40,7 @@
{% endfor %}
</select>
{% for error in errors.field("login") %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
<oswilno-error>{{error|t(hcx)}}</oswilno-error>
{% endfor %}
</div>
<div class="mb-4">
@ -48,7 +48,7 @@
for="spot"
class="block mb-2 text-sm text-gray-600"
>
{{ "Spot"|t(lang,t) }}
{{ "Spot"|t(hcx) }}
</label>
<input
id="spot"
@ -65,9 +65,9 @@
<input
type="submit"
{% if let Some(id) = form.id %}
value="{{"Update parking space"|t(lang,t)}}"
value="{{"Update parking space"|t(hcx)}}"
{% else %}
value="{{"Register parking space"|t(lang,t)}}"
value="{{"Register parking space"|t(hcx)}}"
{% endif %}
class="w-64 bg-cyan-600 text-white py-2 rounded-lg mx-auto block focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 mb-2"
/>

View File

@ -1,14 +1,13 @@
{% match parking_space.state %}
{% when ParkingSpaceState::Pending %}
<div class="text-center p-1 text-sm text-yellow-400 bg-transparent rounded-sm hover:bg-yellow-200 hover:text-yellow-900 dark:hover:bg-yellow-800 dark:hover:text-yellow-300">
{{"Pending"|t(lang,t)}}
<div class="inline-flex items-center text-base text-center p-1 text-sm text-yellow-400 bg-transparent rounded-sm hover:bg-yellow-200 hover:text-yellow-900 dark:hover:bg-yellow-800 dark:hover:text-yellow-300">
{{"Pending"|t(hcx)}}
</div>
{% when ParkingSpaceState::Verified %}
<div class="text-center p-1 text-sm text-blue-400 bg-transparent rounded-sm hover:bg-blue-200 hover:text-blue-900 dark:hover:bg-blue-800 dark:hover:text-blue-300">
{{"Accepted"|t(lang,t)}}
<div>
</div>
{% when ParkingSpaceState::Banned %}
<div class="text-center p-1 text-sm text-red-400 bg-transparent rounded-sm hover:bg-red-200 hover:text-red-900 dark:hover:bg-red-800 dark:hover:text-red-300">
{{"Rejected"|t(lang,t)}}
<div class="inline-flex items-center text-base text-center p-1 text-sm text-red-400 bg-transparent rounded-sm hover:bg-red-200 hover:text-red-900 dark:hover:bg-red-800 dark:hover:text-red-300">
{{"Rejected"|t(hcx)}}
</div>
{% endmatch %}

View File

@ -7,9 +7,7 @@ use actix_web::{get, post, HttpRequest, HttpResponse};
use askama_actix::Template;
use autometrics::autometrics;
use garde::Validate;
use oswilno_view::{
Blank, Errors, HelperContext, Lang, Layout, Main, MainOpts, TranslationStorage,
};
use oswilno_view::{Blank, Errors, HelperContext, Layout, Main, MainOpts};
use sea_orm::DatabaseConnection;
use serde::{Deserialize, Serialize};
@ -168,7 +166,7 @@ async fn login_view(req: HttpRequest, hcx: HelperContext) -> HttpResponse {
body: SignInPartialTemplate {
form: SignInPayload::default(),
errors: Errors::default(),
hcx,
hcx: hcx.clone(),
},
opts: MainOpts {
show: true,
@ -176,6 +174,7 @@ async fn login_view(req: HttpRequest, hcx: HelperContext) -> HttpResponse {
session: None,
},
title: Blank,
hcx,
}
.render()
} else {
@ -184,13 +183,14 @@ async fn login_view(req: HttpRequest, hcx: HelperContext) -> HttpResponse {
body: SignInPartialTemplate {
form: SignInPayload::default(),
errors: Errors::default(),
hcx,
hcx: hcx.clone(),
},
opts: MainOpts {
show: true,
..Default::default()
},
title: Blank,
hcx,
},
}
.render()
@ -436,15 +436,14 @@ struct AccountInfo {
}
#[get("/register")]
async fn register_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpResponse {
async fn register_view(req: HttpRequest, hcx: HelperContext) -> HttpResponse {
HttpResponse::Ok().body(
if oswilno_view::is_partial(&req) {
Main {
body: RegisterPartialTemplate {
form: AccountInfo::default(),
t: t.into_inner(),
lang: Lang::Pl,
errors: oswilno_view::Errors::default(),
hcx: hcx.clone(),
},
title: Blank,
opts: MainOpts {
@ -452,6 +451,7 @@ async fn register_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRes
search: None,
session: None,
},
hcx,
}
.render()
} else {
@ -459,12 +459,12 @@ async fn register_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRes
main: Main {
body: RegisterPartialTemplate {
form: AccountInfo::default(),
t: t.into_inner(),
lang: Lang::Pl,
errors: oswilno_view::Errors::default(),
hcx: hcx.clone(),
},
title: Blank,
opts: MainOpts::default(),
hcx,
},
}
.render()
@ -477,9 +477,8 @@ async fn register_view(req: HttpRequest, t: Data<TranslationStorage>) -> HttpRes
#[template(path = "./register/partial.html")]
struct RegisterPartialTemplate {
form: AccountInfo,
t: Arc<TranslationStorage>,
lang: Lang,
errors: oswilno_view::Errors,
hcx: HelperContext,
}
#[autometrics]
@ -488,10 +487,8 @@ async fn register(
req: HttpRequest,
db: Data<DatabaseConnection>,
payload: Form<AccountInfo>,
t: Data<oswilno_view::TranslationStorage>,
lang: Lang,
hcx: HelperContext,
) -> Result<HttpResponse, Error> {
let t = t.into_inner();
let mut errors = oswilno_view::Errors::default();
Ok(
match register_internal(req, db.into_inner(), payload.into_inner(), &mut errors).await {
@ -499,9 +496,8 @@ async fn register(
Err(p) => HttpResponse::BadRequest().body(
RegisterPartialTemplate {
form: p,
t,
lang,
errors,
hcx,
}
.render()
.unwrap(),

View File

@ -1,11 +1,11 @@
<section id="main-view" class="lg:min-h-ffh xl:min-h-ffhl flex items-top justify-center">
<section class="max-w-md w-full p-6 bg-white rounded-lg shadow-lg">
{% for error in errors.global() %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
<oswilno-error>{{error|t(hcx)}}</oswilno-error>
{% endfor %}
<form hx-post="/register" hx-target="#main-view" hx-replace-url="true" hx-headers='{"Accept":"text/html-partial"}'>
<div class="mb-4">
<label for="login" class="block mb-2 text-sm text-gray-600">{{"Login"|t(lang,t)}}</label>
<label for="login" class="block mb-2 text-sm text-gray-600">{{"Login"|t(hcx)}}</label>
<input
id="login"
name="login"
@ -14,11 +14,11 @@
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
/>
{% for error in errors.field("input_login") %}
<oswilno-error class="mb-2 mt-2">{{error|t(lang,t)}}</oswilno-error>
<oswilno-error class="mb-2 mt-2">{{error|t(hcx)}}</oswilno-error>
{% endfor %}
</div>
<div class="mb-4">
<label for="email" class="block mb-2 text-sm text-gray-600">{{"E-Mail"|t(lang,t)}}</label>
<label for="email" class="block mb-2 text-sm text-gray-600">{{"E-Mail"|t(hcx)}}</label>
<input
id="email"
name="email"
@ -28,11 +28,11 @@
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
/>
{% for error in errors.field("email") %}
<oswilno-error class="mb-2 mt-2">{{error|t(lang,t)}}</oswilno-error>
<oswilno-error class="mb-2 mt-2">{{error|t(hcx)}}</oswilno-error>
{% endfor %}
</div>
<div class="mb-4">
<label for="password" class="block mb-2 text-sm text-gray-600">{{"Password"|t(lang,t)}}</label>
<label for="password" class="block mb-2 text-sm text-gray-600">{{"Password"|t(hcx)}}</label>
<input
id="password"
name="password"
@ -42,11 +42,11 @@
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
/>
{% for error in errors.field("password") %}
<oswilno-error class="mb-2 mt-2">{{error|t(lang,t)}}</oswilno-error>
<oswilno-error class="mb-2 mt-2">{{error|t(hcx)}}</oswilno-error>
{% endfor %}
</div>
<div class="mb-4">
<label for="password_confirmation" class="block mb-2 text-sm text-gray-600">{{"Password confirmation"|t(lang,t)}}</label>
<label for="password_confirmation" class="block mb-2 text-sm text-gray-600">{{"Password confirmation"|t(hcx)}}</label>
<input
id="password_confirmation"
name="password_confirmation"
@ -55,19 +55,19 @@
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
/>
{% for error in errors.field("password_confirmation") %}
<oswilno-error class="mb-2 mt-2">{{error|t(lang,t)}}</oswilno-error>
<oswilno-error class="mb-2 mt-2">{{error|t(hcx)}}</oswilno-error>
{% endfor %}
</div>
<div class="mb-6">
<input
type="submit"
value="{{"Submit"|t(lang,t)}}"
value="{{"Submit"|t(hcx)}}"
class="w-32 bg-cyan-600 text-white py-2 rounded-lg mx-auto block focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 mb-2"
/>
</div>
</form>
<div>
<a href="/login" hx-get="/login" hx-replace-url="true" hx-target="main" hx-headers='{"Accept":"text/html-partial"}'>{{"Sign in"|t(lang,t)}}</a>
<a href="/login" hx-get="/login" hx-replace-url="true" hx-target="main" hx-headers='{"Accept":"text/html-partial"}'>{{"Sign in"|t(hcx)}}</a>
</div>
</section>
</section>

View File

@ -1,7 +1,9 @@
<section id="main-view" class="lg:min-h-ffh xl:min-h-ffhl flex items-top justify-center">
<section class="max-w-md w-full p-6 bg-white rounded-lg shadow-lg">
{% for error in errors.global() %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
<oswilno-error>
{{error|t(hcx)}}
</oswilno-error>
{% endfor %}
<form hx-post="/login" hx-target="#main-view" hx-headers='{"Accept":"text/html-partial"}' hx-replace-url="true">
<div class="mb-4">
@ -14,19 +16,29 @@
<label for="password" class="block mb-2 text-sm text-gray-600">Password</label>
<input id="password" name="password" type="password" value="" class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500" />
{% for error in errors.field("password") %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
<oswilno-error>
{{error|t(hcx)}}
</oswilno-error>
{% endfor %}
</div>
<div class="mb-6">
<input
type="submit"
value="{{"Submit"|t(lang,t)}}"
value="{{"Submit"|t(hcx)}}"
class="w-32 bg-cyan-600 text-white py-2 rounded-lg mx-auto block focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 mb-2"
/>
</div>
</form>
<div>
<a href="/register" hx-get="/register" hx-replace-url="true" hx-target="main" hx-headers='{"Accept":"text/html-partial"}'>{{"Register"|t(lang,t)}}</a>
<a
href="/register"
hx-get="/register"
hx-replace-url="true"
hx-target="main"
hx-headers='{"Accept":"text/html-partial"}'
>
{{"Register"|t(hcx)}}
</a>
</div>
</section>
</section>

View File

@ -72,15 +72,16 @@ impl Default for MainOpts {
#[template(source = "", ext = "txt")]
pub struct Blank;
#[derive(Debug, Default, askama_actix::Template)]
#[derive(Debug, askama_actix::Template)]
#[template(path = "../templates/main.html")]
pub struct Main<BodyTemplate: askama::Template, TitleTemplate: askama::Template = Blank> {
pub title: TitleTemplate,
pub body: BodyTemplate,
pub opts: MainOpts,
pub hcx: HelperContext,
}
#[derive(Debug, Default, askama_actix::Template)]
#[derive(Debug, askama_actix::Template)]
#[template(path = "../templates/base.html")]
pub struct Layout<BodyTemplate: askama::Template> {
pub main: Main<BodyTemplate>,
@ -143,6 +144,9 @@ impl TranslationStorage {
Self {
storage: Arc::new(RwLock::new(HashMap::with_capacity(32))),
}
.with_lang(Lang::Pl)
.add("Marketplace", "Targowisko")
.done()
}
pub fn to_lang(&self, lang: Lang, s: &str) -> String {

View File

@ -10,7 +10,7 @@
class="block py-2 pl-3 pr-4 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500"
aria-current="page"
>
Home
{{"Home"|t(hcx)}}
</a>
</li>
<li>
@ -21,7 +21,7 @@
hx-target="main"
class="block py-2 pl-3 pr-4 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
>
Targowisko
{{"Marketplace"|t(hcx)}}
</a>
</li>
<li>

View File

@ -11,7 +11,7 @@
type="search"
id="search-navbar"
class="block w-full min-w-[35rem] p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Search..."
placeholder='{"Search.."|t(hcx)}'
>
</div>
</div>