Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22622 closed Cleanup/optimization (fixed)

Add imports for ugettext_lazy in documentation

Reported by: anonymous Owned by: niclas.ahden
Component: Documentation Version: dev
Severity: Normal Keywords: afraid-to-commit
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

It shouldn't say:

_("This writer's name is too long.")

it should say:

("This writer's name is too long.")

(in other words, it shouldn't have the underscore)

The code below was taken from: https://docs.djangoproject.com/en/1.6/topics/forms/modelforms/#overriding-the-default-fields

class AuthorForm(ModelForm):
    class Meta:
        model = Author
        fields = ('name', 'title', 'birth_date')
        labels = {
            'name': _('Writer'),
        }
        help_texts = {
            'name': _('Some useful help text.'),
        }
        error_messages = {
            'name': {
                'max_length': _("This writer's name is too long."),
            },
        }

Change History (6)

comment:1 by Tim Graham, 10 years ago

Keywords: code error removed
Summary: Multiple _'s are in the code, although they shouldn't be.Add imports for ugettext_lazy in documentation
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Actually the code is correct, but we could add the following import to help clarify: from django.utils.translation import ugettext_lazy as _

comment:2 by Daniele Procida, 10 years ago

Keywords: afraid-to-commit added

Ear-marked as suitable for a first-time committer at the DjangoCon Europe sprints 2014.

comment:3 by niclas.ahden, 10 years ago

Owner: changed from nobody to niclas.ahden
Status: newassigned

comment:4 by niclas.ahden, 10 years ago

Has patch: set
Version: 1.6master

I made this change during the sprints at DjangoCon EU 2014.

Pull request posted at:

https://github.com/django/django/pull/2663

comment:5 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 7271f5db78f7c369f5dba1c0013b5eff584114df:

Fixed #22622 -- Added ugettext_lazy import in docs

comment:6 by Tim Graham <timograham@…>, 10 years ago

In 1a3371d1e41dba8d49246e6fab1bdf5b2b236d1c:

[1.6.x] Fixed #22622 -- Added ugettext_lazy import in docs

Backport of 7271f5db78 from master

Note: See TracTickets for help on using tickets.
Back to Top