Django JavaScript translation not working

后端 未结 2 452
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-18 02:36

I tried to follow the guide but it\'s not clear enough.

  1. I added this to my urls.py

    urlpatterns = patterns(\'\',
        (r\'^jsi18n/(?P
    
            
2条回答
  •  情歌与酒
    2021-01-18 03:17

    For others with my particular case, js messages are generated and compiled OK but not rendered in templates or pages when you use i18n language urls.

    This is because javascript catalog should be added to i18n urls patterns, not to normal patterns.

    urlpatterns += patterns('', (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), )
    

    =>

    urlpatterns += i18n_patterns('', (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), )
    

提交回复
热议问题