Commit 6187b67b authored by Nicola Spanti's avatar Nicola Spanti
Browse files

[server] Set language of connection in all cases

If `self.lang` was already defined (aka not `None`), the language
was not set. In consequence, when a pview was called, the language
was always considered to be english, this piece of information is
used by gettext, so it resulted in translation always done in
english language instead of using user preference as excepted.

closes #87

--HG--
branch : 3.26
parent 6ed63c9cc7eb
# copyright 2003-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact https://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
#
......@@ -14,7 +14,8 @@
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
# with CubicWeb. If not, see <https://www.gnu.org/licenses/>.
"""Repository users' and internal' sessions."""
from __future__ import print_function
......@@ -363,7 +364,8 @@ class Connection(RequestSessionBase):
self._open = True
self.cnxset = self.repo.cnxsets.get()
if self.lang is None:
self.set_language(self.user.prefered_language())
self.lang = self.user.prefered_language()
self.set_language(self.lang)
return self
def __exit__(self, exctype=None, excvalue=None, tb=None):
......
Supports Markdown
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