Convert language choices into a function
Move language choices generation to documents.utils. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pycountry
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .settings import setting_language_codes
|
||||
|
||||
|
||||
def get_language_choices():
|
||||
return sorted(
|
||||
[
|
||||
(
|
||||
iso639_3, _(pycountry.languages.get(alpha_3=iso639_3).name)
|
||||
) for iso639_3 in setting_language_codes.value
|
||||
], key=lambda x: x[1]
|
||||
)
|
||||
|
||||
|
||||
def parse_range(astr):
|
||||
# http://stackoverflow.com/questions/4248399/
|
||||
|
||||
Reference in New Issue
Block a user