Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates locales and add date supported formats #813

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions files/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-03 20:23+0200\n"
"POT-Creation-Date: 2024-04-11 12:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -57,7 +57,7 @@ msgid "Last opp bilde"
msgstr "Upload new image"

#: files/templates/files/image_confirm_delete.html:4
msgid "Are you sure you want to delete "
msgid "Er du sikker på at du vil slette "
msgstr "Are you sure you want to delete "

#: files/templates/files/images-modal.html:8
Expand Down Expand Up @@ -95,3 +95,6 @@ msgstr "Delete"
#: files/templates/files/single-image.html:12
msgid "Velg"
msgstr "Select"

#~ msgid "Are you sure you want to delete "
#~ msgstr "Are you sure you want to delete "
4 changes: 2 additions & 2 deletions files/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-03 20:23+0200\n"
"POT-Creation-Date: 2024-04-11 12:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -56,7 +56,7 @@ msgid "Last opp bilde"
msgstr ""

#: files/templates/files/image_confirm_delete.html:4
msgid "Are you sure you want to delete "
msgid "Er du sikker på at du vil slette "
msgstr ""

#: files/templates/files/images-modal.html:8
Expand Down
2 changes: 1 addition & 1 deletion files/templates/files/image_confirm_delete.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load i18n %}

<form method="post">{% csrf_token %}
<p>{% trans "Are you sure you want to delete " %}{{ object }}?</p>
<p>{% trans "Er du sikker på at du vil slette " %}{{ object }}?</p>
<input type="submit" value="Confirm">
</form>
68 changes: 50 additions & 18 deletions inventory/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-11 00:10+0200\n"
"POT-Creation-Date: 2024-04-11 12:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -18,11 +18,51 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: inventory/models/item.py:16 inventory/templates/inventory/inventory.html:25
#: inventory/templates/inventory/inventory.html:33
msgid "Navn"
msgstr "Name"

#: inventory/models/item.py:17 inventory/templates/inventory/inventory.html:31
#: inventory/templates/inventory/inventory.html:32
msgid "Lagerbeholdning"
msgstr "Inventory Quantity"

#: inventory/models/item.py:19
#, fuzzy
#| msgid "Lagerbeholdning"
msgid "Ukjent lagerbeholdning"
msgstr "Inventory Quantity"

#: inventory/models/item.py:22
msgid "Kan lånes"
msgstr "Can be borrowed"

#: inventory/models/item.py:24
msgid "Beskrivelse"
msgstr "Description"

#: inventory/models/item.py:26
msgid "Bilde"
msgstr "Image"

#: inventory/models/item.py:28 inventory/templates/inventory/items_list.html:30
msgid "Hylleplass"
msgstr "Shelf Location"

#: inventory/models/item.py:30
msgid "Maks lånevarighet (dager)"
msgstr "Max borrow duration (days)"

#: inventory/models/item.py:33
msgid "Detaljsidevisninger"
msgstr "Page views"

#: inventory/models/item_loan.py:25
msgid "Lån fra"
msgstr "Borrow from"

#: inventory/templates/inventory/edit_item.html:13
#: inventory/templates/inventory/edit_item.html:11
msgid "Rediger lagerinnslag"
msgstr "Edit inventory item"

Expand Down Expand Up @@ -58,11 +98,6 @@ msgstr "View equipment and apparatus"
msgid "Ting, tang og tare"
msgstr "Things and stuff"

#: inventory/templates/inventory/inventory.html:25
#: inventory/templates/inventory/inventory.html:33
msgid "Navn"
msgstr "Name"

#: inventory/templates/inventory/inventory.html:29
msgid "Velg sorteringskriterie"
msgstr "Choose sorting criterion"
Expand All @@ -71,11 +106,6 @@ msgstr "Choose sorting criterion"
msgid "Popularitet"
msgstr "Popularity"

#: inventory/templates/inventory/inventory.html:31
#: inventory/templates/inventory/inventory.html:32
msgid "Lagerbeholdning"
msgstr "Inventory Quantity"

#: inventory/templates/inventory/inventory.html:31
msgid "Synkende"
msgstr "Descending"
Expand Down Expand Up @@ -106,10 +136,6 @@ msgstr "None"
msgid "på lager"
msgstr "in stock"

#: inventory/templates/inventory/items_list.html:30
msgid "Hylleplass"
msgstr "Shelf Location"

#: inventory/templates/inventory/items_list.html:34
msgid "forventet på lager"
msgstr "expected in stock"
Expand Down Expand Up @@ -142,10 +168,16 @@ msgstr "Loan applications"
msgid "Oversikt over lånesøknader"
msgstr "Overview of loan applications"

#: inventory/views/item_loan.py:107
#: inventory/views/item_loan.py:102
msgid "Lånesøknaden er avslått"
msgstr "Loan applications is denied"

#: inventory/views/item_loan.py:124
#: inventory/views/item_loan.py:119
msgid "Lånesøknaden er lukket"
msgstr "Loan application is closed"

#: inventory/views/item_loan.py:146
#, fuzzy
#| msgid "Lånesøknaden er avslått"
msgid "Lånesøknaden er registrert!"
msgstr "Loan applications is denied"
64 changes: 46 additions & 18 deletions inventory/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-11 00:09+0200\n"
"POT-Creation-Date: 2024-04-11 12:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -18,11 +18,49 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: inventory/models/item.py:16 inventory/templates/inventory/inventory.html:25
#: inventory/templates/inventory/inventory.html:33
msgid "Navn"
msgstr ""

#: inventory/models/item.py:17 inventory/templates/inventory/inventory.html:31
#: inventory/templates/inventory/inventory.html:32
msgid "Lagerbeholdning"
msgstr ""

#: inventory/models/item.py:19
msgid "Ukjent lagerbeholdning"
msgstr ""

#: inventory/models/item.py:22
msgid "Kan lånes"
msgstr ""

#: inventory/models/item.py:24
msgid "Beskrivelse"
msgstr ""

#: inventory/models/item.py:26
msgid "Bilde"
msgstr ""

#: inventory/models/item.py:28 inventory/templates/inventory/items_list.html:30
msgid "Hylleplass"
msgstr ""

#: inventory/models/item.py:30
msgid "Maks lånevarighet (dager)"
msgstr ""

#: inventory/models/item.py:33
msgid "Detaljsidevisninger"
msgstr ""

#: inventory/models/item_loan.py:25
msgid "Lån fra"
msgstr ""

#: inventory/templates/inventory/edit_item.html:13
#: inventory/templates/inventory/edit_item.html:11
msgid "Rediger lagerinnslag"
msgstr ""

Expand Down Expand Up @@ -53,11 +91,6 @@ msgstr ""
msgid "Ting, tang og tare"
msgstr ""

#: inventory/templates/inventory/inventory.html:25
#: inventory/templates/inventory/inventory.html:33
msgid "Navn"
msgstr ""

#: inventory/templates/inventory/inventory.html:29
msgid "Velg sorteringskriterie"
msgstr ""
Expand All @@ -66,11 +99,6 @@ msgstr ""
msgid "Popularitet"
msgstr ""

#: inventory/templates/inventory/inventory.html:31
#: inventory/templates/inventory/inventory.html:32
msgid "Lagerbeholdning"
msgstr ""

#: inventory/templates/inventory/inventory.html:31
msgid "Synkende"
msgstr ""
Expand Down Expand Up @@ -101,10 +129,6 @@ msgstr ""
msgid "på lager"
msgstr ""

#: inventory/templates/inventory/items_list.html:30
msgid "Hylleplass"
msgstr ""

#: inventory/templates/inventory/items_list.html:34
msgid "forventet på lager"
msgstr ""
Expand Down Expand Up @@ -137,10 +161,14 @@ msgstr ""
msgid "Oversikt over lånesøknader"
msgstr ""

#: inventory/views/item_loan.py:107
#: inventory/views/item_loan.py:102
msgid "Lånesøknaden er avslått"
msgstr ""

#: inventory/views/item_loan.py:124
#: inventory/views/item_loan.py:119
msgid "Lånesøknaden er lukket"
msgstr ""

#: inventory/views/item_loan.py:146
msgid "Lånesøknaden er registrert!"
msgstr ""
10 changes: 7 additions & 3 deletions inventory/views/item_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ class ItemLoanApplicationView(CreateView):
"consent",
]
template_name = "inventory/loan_apply.html"
success_message = "Lånesøknaden er registrert!"
success_message = _("Lånesøknaden er registrert!")
success_url = reverse_lazy("inventory:inventory")
months_max_ahead = 1
date_format = "%d.%m.%Y"

def get_success_url(self):
# SuccessMessageMixin doesn't actually work so fuck it
Expand Down Expand Up @@ -187,8 +188,11 @@ def get_form(self, *args, **kwargs):
form = super().get_form(*args, **kwargs)
form.fields["loan_to"].widget.attrs["class"] = "datepicker"
form.fields["loan_from"].widget.attrs["class"] = "datepicker"
form.fields["loan_from"].widget.format = "%d.%m.%Y" # Set date format
form.fields["loan_to"].widget.format = "%d.%m.%Y" # Set date format
form.fields["loan_from"].widget.format = self.date_format
form.fields["loan_to"].widget.format = self.date_format
form.fields["loan_from"].input_formats.append(self.date_format)
form.fields["loan_to"].input_formats.append(self.date_format)
print(form.fields["loan_from"].input_formats)
return form

def get_context_data(self, **kwargs):
Expand Down
Loading