You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
by add this <script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' %}"></script>, I can call gettext in my jsx file. However, the render server will not know what gettext is.
You'll need a way to pass that data to the renderer.
I'm not too familiar with internationalisation in django, but I assume you can interrogate the request for a lang and then dump all the data used for gettext, so you can pass it to renderer. If you're not too familiar with how to implement the interrogation, I'd recommend looking at the implementation details for django.views.i18n.javascript_catalog.
Note that once you're handling data like this, you'll probably need different entry points for your code so that you can handle the different contexts. It's a bit of a pain sometimes, but it does have the benefit that your system will end up less coupled to django's front-end.
Activity
markfinger commentedon Aug 12, 2016
You'll need a way to pass that data to the renderer.
I'm not too familiar with internationalisation in django, but I assume you can interrogate the request for a lang and then dump all the data used for
gettext, so you can pass it to renderer. If you're not too familiar with how to implement the interrogation, I'd recommend looking at the implementation details fordjango.views.i18n.javascript_catalog.Note that once you're handling data like this, you'll probably need different entry points for your code so that you can handle the different contexts. It's a bit of a pain sometimes, but it does have the benefit that your system will end up less coupled to django's front-end.
markfinger commentedon Feb 27, 2017
I've linked this question from the README. https://github.com/markfinger/python-react/blob/master/README.md#how-do-i-handle-djangos-translation-and-gettext-with-react-components
Everyone should feel free to continue the discussion if they're so inclined