that has problems:
* While this message is shown to end user, it contains a 0-based index,
which can be a challenge to explain, even in english...
* I believe "list" would be a better term instead of "array" for general
public. The same goes for my language.
* Additional message is concatenated right after this, so the trailing
space is needed in translations too. But on Transifex and many other i18n
tools the space is not apparent.
What about something like this:
`"Item %(nth)s (count from the left) in the list is not valid:"`
--
Ticket URL: <https://code.djangoproject.com/ticket/29131>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
I think indexing from 1 instead of 0 is an improvement.
Changing array to list might be okay, but what about all the messages in
the `ArrayField` model field that use "array".
About the addition of "(count from the left)"... I think that would be
better added in translational only for languages (if any?) where counting
in lists happens from the right?
I see your point about the trailing space -- the translated messages I
checked don't have the trailing space. I guess the idea would be to modify
`contrib.postgres.utils.prefix_validation_error()` to add the space
instead.
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:1>
Comment (by Vlada Macek):
> Changing array to list might be okay, but what about all the messages in
the ArrayField model field that use "array".
Quickly peeking... I'd say this could be the only message observable by
the end user.
> About the addition of "(count from the left)"... I think that would be
better added in translational only for languages (if any?) where counting
in lists happens from the right?
I proposed such suboptimal wording rather to point out the non-technical
people might not be even prepared to count items from either side.
The resulting concatenated message for
`ArrayField(base_field=models.EmailField)` looks like this:
`<field name>: Item %(nth)s in the array did not validate: Enter valid
e-mail address`
Personally I'd expect the value itself to be mentioned:
`<field name>: One of the values in the list (%(value)s) did not validate:
Enter valid e-mail address`
> I guess the idea would be to modify
`contrib.postgres.utils.prefix_validation_error()` to add the space
instead.
Exactly what I found out.
Thank you.
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:2>
Comment (by Tim Graham <timograham@…>):
In [changeset:"b33f10d8cc5037f49d5f9c462c510f0fcf11bcf5" b33f10d]:
{{{
#!CommitTicketReference repository=""
revision="b33f10d8cc5037f49d5f9c462c510f0fcf11bcf5"
Refs #29131 -- Made ArrayField error messages index from 1 instead of 0.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:3>
Comment (by Tim Graham <timograham@…>):
In [changeset:"31ce1f74334add625a4ed82b531d769828237882" 31ce1f74]:
{{{
#!CommitTicketReference repository=""
revision="31ce1f74334add625a4ed82b531d769828237882"
Refs #29131 -- Fixed space handling in ArrayField's item_invalid message.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:4>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:5>
Comment (by Pavel Savchenko):
This feature came as a surprise to us when we upgraded from 2.0 to 2.1, as
we were relying on 0-index (i.e we were adding +1 manually to ).
I guess it's too late for release notes (though we could mention it in
3.1?), though we could also mention that it's 1-indexed in the related
documentation here:
What do you think, shall we create a separate ticket for documenting this?
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:6>
Comment (by felixxm):
I'm not sure what kind of change or documentation improvement we could do.
These patches changed only error messages. Index and slice transforms
still use 0-based indexing.
--
Ticket URL: <https://code.djangoproject.com/ticket/29131#comment:7>