summaryrefslogtreecommitdiff
path: root/ishtar_common/context_processors.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-04-13 18:12:04 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-04-17 15:47:16 +0200
commitbe93026bf245c0a6bda058062982d33baa6d5fec (patch)
treea98b76693731c2e6fd30b8d1a374072914f26ba8 /ishtar_common/context_processors.py
parent902bacb7af4b6bfddffff2187ffd5c6f0a50422a (diff)
downloadIshtar-be93026bf245c0a6bda058062982d33baa6d5fec.tar.bz2
Ishtar-be93026bf245c0a6bda058062982d33baa6d5fec.zip
Changelog: use date format for filenames. Update translations.
Diffstat (limited to 'ishtar_common/context_processors.py')
-rw-r--r--ishtar_common/context_processors.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py
index 8131e0382..d1e088a8f 100644
--- a/ishtar_common/context_processors.py
+++ b/ishtar_common/context_processors.py
@@ -43,9 +43,15 @@ def _get_changelog_version_from_file():
)
if not os.path.exists(changelog_dir):
return "no-version"
- changelog_file = os.path.join(changelog_dir, f"changelog_1.md")
- if not os.path.exists(changelog_file):
+ filename = ""
+ for fle in reversed(sorted(os.listdir(changelog_dir))):
+ if not fle.startswith("changelog_") or not fle.endswith(".md"):
+ continue
+ filename = fle
+ break
+ if not filename:
return "no-version"
+ changelog_file = os.path.join(changelog_dir, filename)
current_version = None
with open(changelog_file, "r") as changelog:
for line in changelog.readlines():
@@ -125,10 +131,11 @@ def get_base_context(request):
if password_expired and not request.path.endswith("password_change/"):
msg = str(_("Your password has expired. Please update it using this "
"<form>."))
+ form_str = _("form")
msg = msg.replace(
"<form>",
f'<a href="{reverse("password_change")}">'
- f'{_("form")} '
+ f'{form_str} '
f'<i class="fa fa-external-link" aria-hidden="true"></i>'
'</a>'
)
@@ -140,15 +147,16 @@ def get_base_context(request):
current_version = get_changelog_version()
if current_version != user_version and "changelog" not in dct["CURRENT_PATH"]:
if user_version:
- msg = str(_("Ishtar have been updated from version <old-version> to <new-version>. "
- "Check the <changelog>."))
+ msg = str(_("Since your last login, Ishtar has been updated from version <old-version> to "
+ "<new-version>. Check the <changelog>."))
else:
- msg = str(_("Ishtar have been updated to version <new-version>. Check the "
- "<changelog>."))
+ msg = str(_("Since your last login, Ishtar has been updated to version <new-version>. "
+ "Check the <changelog>."))
+ changelog_str = _("changelog")
msg = msg.replace(
"<changelog>",
f'<a href="{reverse("changelog")}">'
- f'{_("changelog")} '
+ f'{changelog_str} '
f'<i class="fa fa-external-link" aria-hidden="true"></i>'
f'</a>'
).replace("<old-version>", user_version).replace("<new-version>", current_version)