email: Fix regression error when installing/operation app

- In tags cleanup code, the front page shortcut for email uses different tags
than those provided in the manifest. When the app is instantiated in privileged
code without setting up Django, this causes an error even though gettext_noop is
used. Workaround by using a custom method for this.

Tests:

- Installing, enabling/disabling email apps works.

- 'make update-translations' output shows that django.pot has been updated and
the tags in question are part of the POT file.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-01-09 21:29:42 -08:00 committed by James Valleroy
parent 28e4fe0791
commit 17ff564eeb
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,6 @@ import logging
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_noop
import plinth.app
from plinth import cfg, frontpage, menu
@ -19,7 +18,7 @@ from plinth.modules.letsencrypt.components import LetsEncrypt
from plinth.package import Packages
from plinth.privileged import service as service_privileged
from plinth.signals import domain_added, domain_removed
from plinth.utils import format_lazy
from plinth.utils import format_lazy, gettext_noop
from . import aliases, manifest, privileged

View File

@ -192,3 +192,8 @@ class SafeFormatter(string.Formatter):
return super().get_field(field_name, args, kwargs)
except (AttributeError, TypeError):
return (f'?{field_name}?', '')
def gettext_noop(message: str) -> str:
"""Do nothing. Using this method marks the string for translation."""
return message