Opened 15 months ago

Closed 15 months ago

Last modified 7 weeks ago

#27067 closed Cleanup/optimization (fixed)

Deprecate string_concat

Reported by: Mattias Loverot Owned by: Mattias Loverot
Component: Internationalization 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: 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 Changed 15 months 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 15 months 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 15 months ago by Mattias Loverot

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 Changed 15 months ago by Claude Paroz

I think I'm totally convinced now :-)

comment:6 Changed 15 months ago by Mattias Loverot

Has patch: set

comment:7 Changed 15 months ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:8 Changed 15 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 23151140:

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

comment:9 Changed 2 months ago by Tim Graham <timograham@…>

In 87d2240e:

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

comment:10 Changed 7 weeks 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