-
Notifications
You must be signed in to change notification settings - Fork 133
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
from django.utils.translation import gettext_lazy as _
values_dropdown = dcc.Dropdown(
id="value",
options=[
{"label": _("All values"), "value": "all"},
{"label": _("Value A"), "value": "a"},
{"label": _("Value B"), "value": "b"},
],
value="all",
className="col-md-12",
)
app = DjangoDash("my_app")
app.layout = html.Div(
id="main",
children=[
value_dropdown,
html.Div(id="chart-output"),
])Rendering this app causes the error:
TypeError: Object of type __proxy__ is not JSON serializable
The issue is caused by lazy strings not being serializable out of the box as outlined here: https://stackoverflow.com/questions/19734724/django-is-not-json-serializable-when-using-ugettext-lazy
A workaround could therefore be provided if such serialization was handled by JSON calls in django-plotly-dash, or at the very least to allow provision of custom JSON encoder classes, but this does not appear to be the case.
Right now though it looks like i18n is not easily doable with this package.
olejorgenb
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working