Commit 15ee8e31 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the dbui.JSONEncoder to json.dumps in order to convert lazyT.

parent c7a45b04
......@@ -15,6 +15,7 @@
"""
import json
import os
import plugin_dbui as dbui
from gluon.tools import PluginManager
......@@ -152,7 +153,7 @@ def dbui_conf():
# fill the javascript template
app = request.application
script = API % (app,
json.dumps(config),
json.dumps(config, cls=dbui.JSONEncoder),
debug,
app,
app,
......
......@@ -15,7 +15,7 @@ from gluon.tools import PluginManager
T.set_current_languages("en", "en-gb", "en-us") # mother tongue
T.force("fr-fr") # user language
T.lazy = False # immediate translation
T.lazy = True # no immediate translation
#.............................................................................
#
......
......@@ -3,6 +3,9 @@
"""
import json
import locale
from directsvc import JSONEncoder
from gluon import current
......@@ -39,7 +42,10 @@ class Node(object):
the widget associated to the leaf
"""
di = {'cfg': json.dumps(cfg), 'leaf': True, 'text': text}
di = {'cfg': json.dumps(cfg, cls=JSONEncoder),
'leaf': True,
'text': text}
self.children.append(di)
def add_children(self, leaves, func=None, hidden=[]):
......@@ -67,7 +73,8 @@ class Node(object):
# according to local setting
cvt = {}
for el in leaves:
cvt[T(el)] = el
# NOTE: str is required to force the translation when lazyT is on
cvt[str(T(el))] = el
translate_leaves = cvt.keys()
translate_leaves.sort(cmp=locale.strcoll)
......
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