Add locales

This commit is contained in:
gabatxo1312
2026-01-30 18:23:54 +01:00
parent 577170bfdd
commit 362beac856
22 changed files with 519 additions and 103 deletions
+8 -8
View File
@@ -3,22 +3,22 @@
{% import "components/cards.html" as cards %}
{% block main %}
{{ typography::heading("Editer") }}
{{ typography::heading(t!("book.edit.title")) }}
{% call cards::card() %}
<form method="post" action="/books/{{ book.id }}">
<div class="mb-3">
<label class="form-label" for="title">Name</label>
<label class="form-label" for="title">{{ t!("book.attributes.title") }}</label>
<input type="text" name="title" class="form-control" value="{{ book.title }}" required>
</div>
<div class="mb-3">
<label for="authors" class="form-label">Author(s)</label>
<label for="authors" class="form-label">{{ t!("book.attributes.authors") }}</label>
<input type="text" name="authors" class="form-control" value="{{ book.authors }}" required>
</div>
<div class="mb-3">
<label for="owner_id" class="form-label">Owner</label>
<label for="owner_id" class="form-label">{{ t!("book.attributes.owner") }}</label>
<select name="owner_id" class="form-control" required>
{% for user in users %}
{% if book.owner_id == user.id %}
@@ -31,7 +31,7 @@
</div>
<div class="mb-3">
<label for="current_holder_id" class="form-label">Current Holder</label>
<label for="current_holder_id" class="form-label">{{ t!("book.attributes.current_holder") }}</label>
<select class="form-control" name="current_holder_id">
<option></option>
{% match book.current_holder_id %}
@@ -52,7 +52,7 @@
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<label for="description" class="form-label">{{ t!("book.attributes.description") }}</label>
{% match book.description %}
{% when Some with (description) %}
<textarea name="description" class="form-control">{{ description }}</textarea>
@@ -62,7 +62,7 @@
</div>
<div class="mb-3">
<label class="form-label" for="comment">Comment</label>
<label class="form-label" for="comment">{{ t!("book.attributes.comment") }}</label>
{% match book.comment %}
{% when Some with (comment) %}
<textarea name="comment" class="form-control">{{ comment }}</textarea>
@@ -72,7 +72,7 @@
</div>
<div class="mt-4 text-center">
<input type="submit" value="Edit book" class="btn btn-success">
<input type="submit" value='{{ t!("book.edit.button") }}' class="btn btn-success">
</div>
</form>
{% endcall %}
+9 -9
View File
@@ -4,27 +4,27 @@
{% import "components/inputs.html" as form_helpers %}
{% block main %}
{{ typography::heading("New book") }}
{{ typography::heading(t!("book.new.title")) }}
{% call cards::card() %}
<form method="post" action="/books">
{{ form_helpers::input("title", "Name", is_required = true, placeholder = "Ex: La Petite Dernière") }}
{{ form_helpers::input("authors", "Author(s)", is_required = true, placeholder = "Ex: Fatima Daas") }}
{{ form_helpers::input("title", t!("book.attributes.title"), is_required = true, placeholder = "Ex: La Petite Dernière") }}
{{ form_helpers::input("authors", t!("book.attributes.authors"), is_required = true, placeholder = "Ex: Fatima Daas") }}
{% call(option) form_helpers::select("owner_id", "Owner", users, is_required = true) %}
{% call(option) form_helpers::select("owner_id", t!("book.attributes.owner"), users, is_required = true) %}
<option value="{{ option.id }}">{{ option.name }}</option>
{% endcall %}
{% call(option) form_helpers::select("current_holder_id", "Current Holder", users, is_required = false) %}
{% call(option) form_helpers::select("current_holder_id", t!("book.attributes.current_holder"), users, is_required = false) %}
<option value="{{ option.id }}">{{ option.name }}</option>
{% endcall %}
{{ form_helpers::textarea("description", "Description", rows = 5, is_required = false, placeholder = "Ex: Je mappelle Fatima Daas. Je suis la mazoziya, la petite dernière. Celle à laquelle on ne sest pas préparé. Française dorigine algérienne.") }}
{{ form_helpers::textarea("comment", "Comment", rows = 3, is_required = false, placeholder = "Ex: I recommend it, it's great!") }}
{{ form_helpers::textarea("description", t!("book.attributes.description"), rows = 5, is_required = false, placeholder = "Ex: Je mappelle Fatima Daas. Je suis la mazoziya, la petite dernière. Celle à laquelle on ne sest pas préparé. Française dorigine algérienne.") }}
{{ form_helpers::textarea("comment", t!("book.attributes.comment"), rows = 3, is_required = false, placeholder = "Ex: I recommend it, it's great!") }}
<div class="mt-4 text-center">
<input type="submit" value="Create book" class="btn btn-success">
<input type="submit" value='{{ t!("book.new.button") }}' class="btn btn-success">
</div>
</form>
{% endcall %}
+12 -12
View File
@@ -9,34 +9,34 @@
{% call cards::card() %}
<div class="mt-4">
<h5 class="mt-4 fw-bold">Book details</h5>
{{ fields::field("Name", book.title) }}
{{ fields::field("Authors", book.authors) }}
<h5 class="mt-4 fw-bold">{{ t!("book.show.book_details") }}</h5>
{{ fields::field(t!("book.attributes.title"), book.title) }}
{{ fields::field(t!("book.attributes.authors"), book.authors) }}
{% match book.description %}
{% when Some with (description) %}
{{ fields::field("Description", description) }}
{{ fields::field(t!("book.attributes.description"), description) }}
{% when None %}
{{ fields::field("Description", "-") }}
{{ fields::field(t!("book.attributes.description"), "-") }}
{% endmatch %}
<h5 class="mt-50px fw-bold">User Details</h5>
{{ fields::field("Owner", owner.name) }}
<h5 class="mt-50px fw-bold">{{ t!("book.show.user_details") }}</h5>
{{ fields::field(t!("book.attributes.owner"), owner.name) }}
{% match current_holder %}
{% when Some with (current_holder) %}
{{ fields::field("Current Holder", current_holder.name) }}
{{ fields::field(t!("book.attributes.current_holder"), current_holder.name) }}
{% when None %}
{{ fields::field("Current Holder", "-") }}
{{ fields::field(t!("book.attributes.current_holder"), "-") }}
{% endmatch %}
<h5 class="mt-50px fw-bold">More Informations</h5>
<h5 class="mt-50px fw-bold">{{ t!("book.show.more_informations") }}</h5>
{% match book.comment %}
{% when Some with (comment) %}
{{ fields::field("Comment", comment) }}
{{ fields::field(t!("book.attributes.comment"), comment) }}
{% when None %}
{{ fields::field("Comment", "-") }}
{{ fields::field(t!("book.attributes.comment"), "-") }}
{% endmatch %}
</div>
{% endcall %}