I followed the Django doc to internalize the js files, but it does not work. Here's my setup:
settings.py:
LOCALE_PATHS = (os.path.join(BASE_DIR, 'locale'),)
urls.py in root project:
from django.views.i18n import JavaScriptCatalog
from django.conf.urls.i18n import i18n_patterns
urlpatterns += i18n_patterns(
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
)
Running the following commands inside the folder and the .po and .mo files were generated:
django-admin makemessages -l pt_BR
django-admin makemessages -d djangojs -l pt_BR
django-admin makemessages -a
django-admin compilemessages
django.po file:
msgid "Customer"
msgstr "Cliente"
In the html template use as follows:
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
console.log( gettext('Customer') );
Nothing happens, the text continues in English. Does anyone know what can it be?