77from django .urls import reverse
88from django .utils .html import format_html
99from django .utils .safestring import mark_safe
10- from django .utils .translation import ugettext_lazy
1110from pytz import timezone
12- from django .utils .translation import ugettext_lazy as _
11+ try :
12+ from django .utils .translation import ugettext_lazy as _
13+ except ImportError :
14+ from django .utils .translation import gettext_lazy as _
1315
1416from taskmanager .models import AppCommand , Report , Task , TaskCategory
1517from taskmanager .settings import (
@@ -52,7 +54,7 @@ def log_tail(self, obj):
5254 lines += log_tail (obj .log , n_max_lines )
5355 if getattr (settings , "UWSGI_TASKMANAGER_SHOW_LOGVIEWER_LINK" , False ):
5456 last_report_url = reverse ("live_log_viewer" , args = (obj .pk ,))
55- lines += ugettext_lazy (
57+ lines += _ (
5658 (
5759 "\n \n <a href='{0}' target='_blank'>"
5860 "Show the log messages</a>"
@@ -240,7 +242,7 @@ def get_actions(self, request):
240242 actions ["delete_selected" ] = (
241243 BulkDeleteMixin .action_safe_bulk_delete ,
242244 "delete_selected" ,
243- ugettext_lazy ("Delete selected %(verbose_name_plural)s" ),
245+ _ ("Delete selected %(verbose_name_plural)s" ),
244246 )
245247 return actions
246248
@@ -386,7 +388,7 @@ def stop_tasks(self, request, queryset):
386388 level = messages .SUCCESS ,
387389 )
388390
389- stop_tasks .short_description = ugettext_lazy ("Stop selected tasks" )
391+ stop_tasks .short_description = _ ("Stop selected tasks" )
390392
391393 def launch_tasks (self , request , queryset ):
392394 """Launch selected tasks."""
@@ -396,7 +398,7 @@ def launch_tasks(self, request, queryset):
396398 request , f"{ len (queryset )} tasks launched" , level = messages .SUCCESS
397399 )
398400
399- launch_tasks .short_description = ugettext_lazy ("Start selected tasks" )
401+ launch_tasks .short_description = _ ("Start selected tasks" )
400402
401403 def repetition (self , obj ):
402404 """Return the string representation of the repetition."""
0 commit comments