Edgewall Software
Modify

Opened 9 years ago

Last modified 14 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):  
    599599
    600600    _type = 'unknown'
    601601    _enum_cls = None
     602    _no_item_selected = None
    602603
    603604    # TicketAdminPanel methods
    604605
    class AbstractEnumAdminPanel(TicketAdminPanel):  
    651652                elif req.args.get('remove'):
    652653                    sel = req.args.get('sel')
    653654                    if not sel:
    654                         raise TracError(_("No %s selected") % self._type)
     655                        raise TracError(gettext(self._no_item_selected))
    655656                    if not isinstance(sel, list):
    656657                        sel = [sel]
    657658                    with self.env.db_transaction:
    class PriorityAdminPanel(AbstractEnumAdminPanel):  
    789790    _type = 'priority'
    790791    _enum_cls = model.Priority
    791792    _label = (N_('Priority'), N_('Priorities'))
     793    _no_item_selected = N_("No priority selected")
    792794
    793795
    794796class ResolutionAdminPanel(AbstractEnumAdminPanel):
    795797    _type = 'resolution'
    796798    _enum_cls = model.Resolution
    797799    _label = (N_('Resolution'), N_('Resolutions'))
     800    _no_item_selected = N_("No resolution selected")
    798801
    799802
    800803class SeverityAdminPanel(AbstractEnumAdminPanel):
    801804    _type = 'severity'
    802805    _enum_cls = model.Severity
    803806    _label = (N_('Severity'), N_('Severities'))
     807    _no_item_selected = N_("No severity selected")
    804808
    805809
    806810class TicketTypeAdminPanel(AbstractEnumAdminPanel):
    807811    _type = 'type'
    808812    _enum_cls = model.Type
    809813    _label = (N_('Ticket Type'), N_('Ticket Types'))
     814    _no_item_selected = N_("No ticket type selected")
    810815
    811816    _command_type = 'ticket_type'
    812817    _command_help = {

Attachments (0)

Change History (5)

comment:1 by Christian Boos, 9 years ago

It's probably a good intermediate step until we finally tackle the TracDev/Proposals/ConfigEnumTranslation issue.

comment:2 by Ryan J Ollos, 8 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 Ryan J Ollos, 8 years ago

Milestone: next-stable-1.0.xnext-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 Ryan J Ollos, 5 years ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

comment:5 by Ryan J Ollos, 14 months ago

Milestone: next-stable-1.4.xnext-stable-1.6.x

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.