#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 , 9 years ago
comment:2 by , 9 years ago
| Triage Stage: | Unreviewed → Accepted | 
|---|
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 , 9 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
https://github.com/lovmat/django/tree/ticket_27067
Todo: Documentation
Depends on: #26866 / PR 7087
comment:5 by , 9 years ago
https://docs.djangoproject.com/en/1.10/topics/i18n/translation/#joining-strings-string-concat will also need an update.
comment:6 by , 9 years ago
| Has patch: | set | 
|---|
comment:7 by , 9 years ago
| Triage Stage: | Accepted → Ready for checkin | 
|---|
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.