Code

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#20398 closed Cleanup/optimization (fixed)

Language select code suggestion

Reported by: ggbaker Owned by: nobody
Component: Documentation Version: master
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).

Attachments (0)

Change History (6)

comment:1 Changed 14 months ago by wim@…

  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 14 months ago by svisser

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

comment:3 Changed 14 months ago by svisser

  • Has patch set

comment:4 Changed 14 months ago by bmispelon

  • Triage Stage changed from Accepted to Ready for checkin

Patch looks good.

I'm marking this as ready for checkin.

Thanks.

comment:5 Changed 14 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 14 months ago by Tim Graham <timograham@…>

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.