Re: [Django] #15156: Ordinal numbers in English and in other locales

45 views
Skip to first unread message

Django

unread,
Dec 11, 2011, 7:00:37 AM12/11/11
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-------------------------------------+-------------------------------------
Reporter: Besnik <besnik@…> | Owner: nobody
Type: New feature | Status: new
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 0 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* 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.

Django

unread,
Feb 23, 2013, 9:32:19 AM2/23/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------

Reporter: Besnik <besnik@…> | Owner: nobody
Type: New feature | Status: new
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by jezdez):

* 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>

Django

unread,
May 18, 2013, 5:53:23 AM5/18/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: nobody
Type: New feature | Status: new
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
May 18, 2013, 6:10:39 AM5/18/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: nobody
Type: New feature | Status: new
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
May 18, 2013, 6:16:08 AM5/18/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: nobody
Type: New feature | Status: new
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
May 18, 2013, 7:31:05 AM5/18/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: zerok
Type: New feature | Status: assigned

Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by zerok):

* owner: nobody => zerok
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:10>

Django

unread,
May 25, 2013, 6:41:06 AM5/25/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: zerok
Type: New feature | Status: assigned
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
May 26, 2013, 4:51:39 AM5/26/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: zerok
Type: New feature | Status: assigned
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
Jun 2, 2013, 7:59:02 AM6/2/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: zerok
Type: New feature | Status: assigned
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

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>

Django

unread,
Aug 31, 2013, 4:23:16 AM8/31/13
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
-----------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner:
Type: New feature | Status: new
Component: Translations | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by zerok):

* 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>

Django

unread,
Dec 18, 2014, 2:54:56 PM12/18/14
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
--------------------------------------+------------------------------------

Reporter: Besnik <besnik@…> | Owner:
Type: New feature | Status: new
Component: Internationalization | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* version: 1.2 => master
* component: Translations => Internationalization


--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:15>

Django

unread,
Mar 18, 2024, 3:09:10 AM3/18/24
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
--------------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: (none)
Type: New feature | Status: new
Component: Internationalization | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:16>

Django

unread,
Nov 2, 2024, 5:33:48 PM11/2/24
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
--------------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: (none)
Type: New feature | Status: new
Component: Internationalization | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Maciej Olko):

* cc: Maciej Olko (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:17>

Django

unread,
Nov 2, 2024, 5:42:38 PM11/2/24
to django-...@googlegroups.com
#15156: Ordinal numbers in English and in other locales
--------------------------------------+------------------------------------
Reporter: Besnik <besnik@…> | Owner: (none)
Type: New feature | Status: new
Component: Internationalization | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Maciej Olko):

The situation discussed here was improved in #28877 – now prefixes in
ordinal numbers are allowed, which fixes Chinese translation. Gender
wasn't in scope.
--
Ticket URL: <https://code.djangoproject.com/ticket/15156#comment:18>
Reply all
Reply to author
Forward
0 new messages