misc: get language from default locale if none specified (#7343)

This commit is contained in:
Frédéric Péters 2015-05-29 16:20:34 +02:00
parent e5f9129194
commit 506e186742
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import imp
import os
import fcntl
import json
import locale
import random
import socket
import sys
@ -600,6 +601,10 @@ class QommonPublisher(Publisher):
for l in accepted_languages:
if l in self.translations.keys():
return l
elif lang is None:
default_locale = locale.getdefaultlocale()
if default_locale and default_locale[0]:
lang = default_locale[0].split('_')[0]
return lang
def get_admin_module(cls):