* ui_ux: => 0
* easy: => 0
Comment:
We might improve things slightly by using `pgettext_lazy` instead of
`ugettext_lazy`.
That would make it possible to distinguish the `'th'` for 0 from the
`'th'` for 5 in this list:
{{{
suffixes = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'),
_('th'), _('th'), _('th'))
}}}
Would this be useful? If it isn't, then I think we should just close this
as "wontfix".
Handling gender in the `ordinal` filter is another topic, I suggest
opening another ticket for this feature if you deem it useful.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Design decision needed => Accepted
Comment:
I agree with aausgustin's idea of using pgettext. It's better than
nothing.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:6>
Comment (by zerok):
Given the severe differences between how different languages "count"
wouldn't that in the worst case require the context to actually include
the number itself?
I skimmed a little bit through
http://en.wikipedia.org/wiki/Ordinal_indicator and some pages about the
Japanese and Chinese languages going with at worst 1-10+above should be
enough except for following exceptions:
* Swedish: Here every number that ends with a 1 or 2 has to suffixed with
":a" instead of ":e"
* Russian
* Catalan
* Galician, Italian, Portuguese, and Spanish: The suffix depends on the
gender of the noun to be counted
That being said, the list on Wikipedia looks very incomplete, but if the
information about very widely uses languages like Spanish is correct here,
the context would have to include the whole number, which looks rather
impractical to me :-/
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:7>
Comment (by claudep):
I'm not suprised at all by your findings. I maintain my original opinion:
the rules are too much diverse to be able to solve this by mere
translation.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:8>
Comment (by aaugustin):
Yeah, the fixed proposed here is "better than nothing, fixes it for a few
languages". It's by no means a definitive solution.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:9>
* owner: nobody => zerok
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:10>
Comment (by claudep):
Proposal: Allow defining a `def ordinal(value):` function in
conf/locale/<lang>/formats.py. We could then generate the ordinal string
by calling `get_format('ordinal')(value)`.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:11>
Comment (by zerok):
Yes, I was thinking along the same line. formats.py is probably the best
place for this too. At first I thought that may be localflavor would be
better, but since that is based around countries and not languages,
formats.py sounds to me like the ideal place.
I will try to come up with an implementation in the next week or so.
Sorry for the delay on this.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:12>
Comment (by zerok):
One issue I see there so far is how to deal with setups where USE_L10N is
disabled. Should in this case a fallback implementation be just used from
locales.en.formats or should this be integrated in the global_settings
module? IMO the first one makes more sense since this would be the one and
only callable in the whole settings module right now which would break the
style there.
Something else I'd like to get in there is having the system still be
based around messages in order to allow users to get their custom
"context" (referencing the noun the ordinal is intended for) into the
message. This way languages like Spanish that don't have a gender-neutral
ordinal-indicator could detect the necessary gender from something like {{
num|ordinal:"email" }}.
I don't know if the ordinal would always reference the same noun in a
sentence independent of the language but it should get around at least
some of the edge cases.
@Besnik Would this help in your situation?
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:13>
* owner: zerok =>
* status: assigned => new
Comment:
Sorry, but I didn't find and probably won't find the time this ticket
requires. I've therefor deasigned it.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:14>
* version: 1.2 => master
* component: Translations => Internationalization
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:15>