From 506e1867429a7ff759ece601bf8b42fff56277bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 29 May 2015 16:20:34 +0200 Subject: [PATCH] misc: get language from default locale if none specified (#7343) --- wcs/qommon/publisher.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wcs/qommon/publisher.py b/wcs/qommon/publisher.py index 7973022fe..a0fb073be 100644 --- a/wcs/qommon/publisher.py +++ b/wcs/qommon/publisher.py @@ -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):