Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#27067 closed Cleanup/optimization (fixed)

Deprecate string_concat

Reported by: Mattias Loverot Owned by: Mattias Loverot
Component: Internationalization 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: no UI/UX: no

Description

Continuing from #26866 I'd like to deprecate django.utils.translation.string_concat in favor of django.utils.text.format_lazy. string_concat can easily be replaced by format_lazy in Django source code.

The only use case I can think of where string_concat is still needed is when concatenating an arbitrary amount of list elements. My guess is that this use case rarely exists - and those that do exist might be able to use django.utils.text.get_text_list ?

(An alternative approach would be to move django.utils.translation.string_concat to django.utils.text.concat_lazy - since django.utils.text is more appropriate)

Change History (10)

comment:1 by Mattias Loverot, 8 years ago

Just realized string_concat could be directly replaced by:

format_lazy('{}'*len(params), *params)

Maybe not the prettiest but should work for those rare cases.

comment:2 by Claude Paroz, 8 years ago

Triage Stage: UnreviewedAccepted

I'm fully for deprecating string_concat if we have a nice replacement. I guess the first step to demonstrate the feasibility is to do the replacement for Django usage itself.

comment:3 by Mattias Loverot, 8 years ago

Owner: changed from nobody to Mattias Loverot
Status: newassigned

https://github.com/lovmat/django/tree/ticket_27067
Todo: Documentation
Depends on: #26866 / PR 7087

comment:4 by Claude Paroz, 8 years ago

I think I'm totally convinced now :-)

comment:6 by Mattias Loverot, 8 years ago

Has patch: set

comment:7 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: assignedclosed

In 23151140:

Fixed #27067 -- Deprecated string_concat() in favor of format_lazy().

comment:9 by Tim Graham <timograham@…>, 7 years ago

In 87d2240e:

Refs #27067 -- Removed django.utils.translation.string_concat() per deprecation timeline.

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

In 3fa0a82:

Refs #27067 -- Removed string_concat in django.utils.translation.all.

Undefined since 87d2240e6cc594a3bf28dfdb2ec023c54fb76ff7.

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