From 142d69997ab3175477494fa9d86aa339568dc7e9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 3 Feb 2025 17:26:32 +0100 Subject: ✨ account sheet: explicit display of permissions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/views_item.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ishtar_common/views_item.py') diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 89caaef77..7407eb37f 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -41,11 +41,12 @@ from django.shortcuts import render from django.template import loader from django.urls import reverse, NoReverseMatch from django.utils.translation import ( - ugettext, - ugettext_lazy as _, activate, deactivate, + get_language, pgettext_lazy, + ugettext, + ugettext_lazy as _, ) from guardian.models import UserObjectPermission from tidylib import tidy_document as tidy @@ -458,6 +459,20 @@ def filter_sheet(ishtar_user, item): return new_item +PUNCTUATION = { + "fr": { + "colon": " :", + "exclamation": " !", + "question": " ?", + }, + "en": { + "colon": ":", + "exclamation": "!", + "question": "?", + }, +} + + def show_item(model, name, extra_dct=None, model_for_perms=None, callback=None): def func(request, pk, **dct): check_model = model @@ -497,6 +512,10 @@ def show_item(model, name, extra_dct=None, model_for_perms=None, callback=None): dct["ENCODING"] = settings.ENCODING dct["DOT_GENERATION"] = settings.DOT_BINARY and profile.relation_graph dct["SHOW_GEO"] = profile.mapping + current_language = get_language() + if current_language not in PUNCTUATION: + current_language = "en" + dct["PUNCTUATION"] = PUNCTUATION[current_language] dct["current_window_url"] = url_name date = None if "date" in dct: -- cgit v1.2.3