我试图无济于事地运行此命令django-admin.py makemessages -d djangojs -l en。我已经尝试过这里所说的内容:Unable to generate django javascript i18n catalog
我当前正在运行gettext版本0.18.3
urls.py

from django.conf.urls import patterns, include, url
from django.views.i18n import javascript_catalog
from django.contrib import admin

js_info_dict = {
    'packages': ('MyApp',),
}

admin.autodiscover()

urlpatterns = patterns('',

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', 'MyApp.views.test'),
    url(r'^jsi18n/$', javascript_catalog, js_info_dict),
)
相关设置
LOCALE_PATHS = (
    '/Users/Saturnix/PycharmProjects/TranslationTest/MyApp/locale',
)

TEMPLATE_DIRS = (
    '/Users/Saturnix/PycharmProjects/TranslationTest/templates/',
)
(我也尝试过将模板文件夹放在MyApp中,并相应地调整设置:相同的结果)。
views.py
def test(request):
    return render_to_response("test.html", locals())
test.html(在templates文件夹中)
... some html ...
{% trans 'HELLO_STRING_TEMPLATE' %}
... some javascript ...
document.write(gettext('HELLO_STRING_JS'));
当我运行django-admin.py makemessages -d djangojs -l en时,我得到

我应该怎么办?

最佳答案

这种模糊的错误消息基本上意味着makemessages找不到任何要翻译的内容。

关于python - djangojs makemessage失败-djangojs.pot : No such file or directory,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23748835/

10-16 15:56