Commit 2501550a authored by Mathieu Bridon's avatar Mathieu Bridon
Browse files

wip currently used languages

parent 23c79889
......@@ -31,7 +31,10 @@ def get_local_languages():
# Import here to avoid cyclic import
from ideascube.models import Setting
default = ['ar', 'en', 'es', 'fr']
default = _get_used_languages()
if not default:
default = ['ar', 'en', 'es', 'fr']
return Setting.get_list('content', 'local-languages', default=default)
......@@ -47,6 +50,21 @@ def get_server_name():
return Setting.get_string('server', 'site-name', default=default)
def _get_used_languages():
# Import here to avoid cyclic import
from import Content
from ideascube.library.models import Book
from ideascube.mediacenter.models import Document
langs = set()
for model in (Content, Book, Document):
for obj in model.objects.all():
return sorted(langs)
# We do not use functool.partial cause we want to mock stderr for unittest
# If we use partial we keep a ref to the original sys.stderr and output is not
# captured.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment