Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20398 closed Cleanup/optimization (fixed)

Language select code suggestion

Reported by: ggbaker Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I was just looking at the example template snippet where the user can select their language:
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#the-set-language-redirect-view

I'd suggest that the <option> tag change from this:

<option value="{{ language.code }}">

to this:

<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>

I think that's much nicer (since I suspect a lot of people copy those code snippets without looking too closely).

Change History (6)

comment:1 by wim@…, 11 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

comment:2 by svisser, 11 years ago

Pull request is available here: https://github.com/django/django/pull/1057

comment:3 by svisser, 11 years ago

Has patch: set

comment:4 by Baptiste Mispelon, 11 years ago

Triage Stage: AcceptedReady for checkin

Patch looks good.

I'm marking this as ready for checkin.

Thanks.

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

Resolution: fixed
Status: newclosed

In 897e4eab6531cdbaf27c1b2a6716c86eb6ee1f5d:

Fixed #20398 - Added language selection code to example in documentation

Thanks ggbaker for the suggestion and Simeon Visser for the patch.

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

In cac0f7b72e5d42239803df5338db03f1d19c22e6:

[1.5.x] Fixed #20398 - Added language selection code to example in documentation

Thanks ggbaker for the suggestion and Simeon Visser for the patch.

Backport of 897e4eab65 from master

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