Opened 6 years ago

Closed 6 years ago

Last modified 5 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


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 Changed 6 years ago by Mattias Loverot

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 Changed 6 years ago by Claude Paroz

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 Changed 6 years ago by Mattias Loverot

Owner: changed from nobody to Mattias Loverot
Status: newassigned
Todo: Documentation
Depends on: #26866 / PR 7087

comment:4 Changed 6 years ago by Claude Paroz

I think I'm totally convinced now :-)

comment:6 Changed 6 years ago by Mattias Loverot

Has patch: set

comment:7 Changed 6 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: assignedclosed

In 23151140:

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

comment:9 Changed 5 years ago by Tim Graham <timograham@…>

In 87d2240e:

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

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

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