Move LocalizedValue and add get_language_codes

This commit is contained in:
Swen Kooij
2017-02-01 15:06:36 +02:00
parent 680383b636
commit 105c1e7b6b
8 changed files with 43 additions and 15 deletions

21
localized_fields/util.py Normal file
View File

@@ -0,0 +1,21 @@
from typing import List
from django.conf import settings
def get_language_codes() -> List[str]:
"""Gets a list of all available language codes.
This looks at your project's settings.LANGUAGES
and returns a flat list of the configured
language codes.
Arguments:
A flat list of all availble language codes
in your project.
"""
return [
lang_code
for lang_code, _ in settings.LANGUAGES
]