Opened 9 years ago
Last modified 15 months ago
#12367 new defect
Error message with untranslated text when removing no selected items
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | next-stable-1.6.x |
Component: | ticket system | Version: | |
Severity: | minor | Keywords: | i18n admin |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In /admin/ticket/priority page, Remove selected items
with no selection shows the following message in French.
Aucun priority sélectionné
priority
text is untranslated….
2016-02-26 19:27:04,572 Trac[main] WARNING: [192.168.11.11] HTTPInternalError: 500 Erreur Trac (Aucun priority sélectionné)
It would be good to add localized message for each enum of ticket.
-
trac/ticket/admin.py
diff --git a/trac/ticket/admin.py b/trac/ticket/admin.py index acd9d4ec5..ef410cbb7 100644
a b class AbstractEnumAdminPanel(TicketAdminPanel): 599 599 600 600 _type = 'unknown' 601 601 _enum_cls = None 602 _no_item_selected = None 602 603 603 604 # TicketAdminPanel methods 604 605 … … class AbstractEnumAdminPanel(TicketAdminPanel): 651 652 elif req.args.get('remove'): 652 653 sel = req.args.get('sel') 653 654 if not sel: 654 raise TracError( _("No %s selected") % self._type)655 raise TracError(gettext(self._no_item_selected)) 655 656 if not isinstance(sel, list): 656 657 sel = [sel] 657 658 with self.env.db_transaction: … … class PriorityAdminPanel(AbstractEnumAdminPanel): 789 790 _type = 'priority' 790 791 _enum_cls = model.Priority 791 792 _label = (N_('Priority'), N_('Priorities')) 793 _no_item_selected = N_("No priority selected") 792 794 793 795 794 796 class ResolutionAdminPanel(AbstractEnumAdminPanel): 795 797 _type = 'resolution' 796 798 _enum_cls = model.Resolution 797 799 _label = (N_('Resolution'), N_('Resolutions')) 800 _no_item_selected = N_("No resolution selected") 798 801 799 802 800 803 class SeverityAdminPanel(AbstractEnumAdminPanel): 801 804 _type = 'severity' 802 805 _enum_cls = model.Severity 803 806 _label = (N_('Severity'), N_('Severities')) 807 _no_item_selected = N_("No severity selected") 804 808 805 809 806 810 class TicketTypeAdminPanel(AbstractEnumAdminPanel): 807 811 _type = 'type' 808 812 _enum_cls = model.Type 809 813 _label = (N_('Ticket Type'), N_('Ticket Types')) 814 _no_item_selected = N_("No ticket type selected") 810 815 811 816 _command_type = 'ticket_type' 812 817 _command_help = {
Attachments (0)
Change History (5)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
This is an aside related to one of the lines that has been changed in the proposed patch. The line is:
_("No %s selected") % self._type
whereas usually we would write that as:
_("No %(type)s selected", type=self._type)
I imagine that %(type)s
is a better hint to translations, as opposed to %s
. Are there any other impacts of using the former rather than the latter?
One reason I ask is that I see the former pattern used at many places in SpamFilter. One such place I corrected in [14836], to follow the more typical pattern we see in Trac. However, I was unable to find any positive or negative functional effects of this change.
comment:3 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.
comment:4 by , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|
It's probably a good intermediate step until we finally tackle the TracDev/Proposals/ConfigEnumTranslation issue.