Opened 8 years ago

Closed 7 years ago

#27449 closed New feature (fixed)

Make django.utils.translation.trans_real.get_supported_language_variant public API

Reported by: Iacopo Spalletti Owned by: Sebastian Sangervasi
Component: Internationalization Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Iacopo Spalletti)

How about making django.utils.translation.trans_real.get_supported_language_variant part of the public API?

A use case for this: Check if a given language is within the ones listed in LANGUAGES, including the sublanguages, as stated in https://docs.djangoproject.com/en/1.10/topics/i18n/translation/:

This example restricts languages that are available for automatic selection to German and English (and any sublanguage, like de-ch or en-us).

Example: https://github.com/django-parler/django-parler/issues/156

Making this public will involve:

  • Adding documentation
  • Exposing it in django.utils.translation

Change History (12)

comment:1 by Ingo Klöcker, 8 years ago

Type: UncategorizedNew feature

comment:2 by Ingo Klöcker, 8 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

I think it makes sense to make it public API. It also seems to be fairly easy to do.

comment:3 by Iacopo Spalletti, 8 years ago

Owner: changed from nobody to Iacopo Spalletti
Status: newassigned

comment:4 by Iacopo Spalletti, 8 years ago

Description: modified (diff)

comment:5 by Iacopo Spalletti, 8 years ago

I will work on a patch

comment:6 by Lee Cartwright, 8 years ago

It's been a while since this ticket was updated. Are there any objections to me taking it on?

comment:7 by Sebastian Sangervasi, 7 years ago

Owner: changed from Iacopo Spalletti to Sebastian Sangervasi

This seems to have gone unattended for four months, so I worked on it as a first contribution. I have a pull request ready to go, so I'm going to claim this.

comment:8 by Sebastian Sangervasi, 7 years ago

Has patch: set

I have submitted a pull request: https://github.com/django/django/pull/8682

I followed procedure for the creation of new tests and all tests pass. However, I had some questions about how tests are being done for translation. I'm going to ask these these questions on the pull request, but I can move them here if that is preferred.

comment:9 by Sebastian Sangervasi, 7 years ago

My patch has been reviewed and, after some documentation updates, should be ready to merge into 2.1.

comment:10 by Carlton Gibson, 7 years ago

Needs documentation: set

comment:11 by Carlton Gibson, 7 years ago

Needs documentation: unset
Triage Stage: AcceptedReady for checkin

comment:12 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 7905815:

Fixed #27449 -- Added django.utils.translation.get_supported_language_variant().

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