Opened 6 years ago

Closed 6 years ago

#26319 closed Bug (fixed)

British English can't be returned from the javascript_catalog

Reported by: Doug Fish Owned by: nobody
Component: Internationalization Version: 1.9
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

We have translations for British English (Australian English too!) and they aren't displayed in javascript based segments of our Django application.

Digging into the problem I believe the issue is in Django. Specifically this line:
https://github.com/django/django/blob/master/django/views/i18n.py#L212

Ultimately makes every English variant fall back to plain "en" at
https://github.com/django/django/blob/master/django/views/i18n.py#L248

I suggest the fix is to check for equality over starts with at line 212.

Change History (10)

comment:1 Changed 6 years ago by Tim Graham

Component: UncategorizedInternationalization
Type: UncategorizedBug

Do you plan to submit a tested patch? It doesn't seem that reproducing the issue will be very easy for me given the sparse details you provided so far and my lack of translation expertise.

comment:2 Changed 6 years ago by Doug Fish

I don't currently plan to submit such a patch. I lack the corporate approval to contribute to Django.

I shared my idea with one of my co-contributors from the OpenStack Horizon project, he tried it out and it apparently doesn't pass tests.

I'll try to sort out if I can create a small sample that will fail. Would that be helpful?

comment:3 Changed 6 years ago by Tim Graham

Yes, if you can submit it as a unit test in view_tests/tests/test_i18n.py even better.

comment:4 Changed 6 years ago by Tim Graham

A related ticket is #26328 -- can you say if the changes proposed there might solve your issue? (There should be a pull request soon). Maybe you can dialog with that ticket author a bit.

Last edited 6 years ago by Tim Graham (previous) (diff)

comment:5 Changed 6 years ago by Doug Fish

I tried out the fix from the linked discussion and that will solve the issue!

comment:6 Changed 6 years ago by Tim Graham

Has patch: set
Triage Stage: UnreviewedAccepted

comment:7 Changed 6 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

A test for this ticket is added in a PR from Claude.

comment:8 Changed 6 years ago by Claude Paroz <claude@…>

In 11c60b5:

Reused the DjangoTranslation class for the javascript_catalog view

Thanks Tim Graham and Cristiano Coelho for the reviews.
Refs #26328, #26319.

comment:9 Changed 6 years ago by Claude Paroz <claude@…>

In ecbdedfc:

Refs #26319 -- Added test for English variant in javascript_catalog

comment:10 Changed 6 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

Hopefully fixed now.

Note: See TracTickets for help on using tickets.
Back to Top