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``
--
Ticket URL: <https://code.djangoproject.com/ticket/27449>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => New feature
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:1>
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
I think it makes sense to make it public API. It also seems to be fairly
easy to do.
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:2>
* owner: nobody => Iacopo Spalletti
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:3>
Old description:
> 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``
New description:
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`
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:4>
Comment (by Iacopo Spalletti):
I will work on a patch
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:5>
Comment (by Lee Cartwright):
It's been a while since this ticket was updated. Are there any objections
to me taking it on?
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:6>
* owner: Iacopo Spalletti => Sebastian Sangervasi
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:7>
* has_patch: 0 => 1
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:8>
Comment (by Sebastian Sangervasi):
My patch has been reviewed and, after some documentation updates, should
be ready to merge into 2.1.
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:9>
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:10>
* needs_docs: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"7905815510fb1eae99010ccc0039249d981a121c" 7905815]:
{{{
#!CommitTicketReference repository=""
revision="7905815510fb1eae99010ccc0039249d981a121c"
Fixed #27449 -- Added
django.utils.translation.get_supported_language_variant().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27449#comment:12>