gpt4 book ai didi

python - djangojs makemessage 失败 - djangojs.pot : No such file or directory

转载 作者:太空狗 更新时间:2023-10-30 01:01:37 26 4
gpt4 key购买 nike

我正在尝试运行此命令 django-admin.py makemessages -d djangojs -l en 但无济于事。我已经尝试过这里所说的:Unable to generate django javascript i18n catalog

我目前正在运行 gettext 版本 0.18.3

网址.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 并相应地调整设置:结果相同)。

View .py

def test(request):
return render_to_response("test.html", locals())

test.html(在模板文件夹中)

... some html ...
{% trans 'HELLO_STRING_TEMPLATE' %}
... some javascript ...
document.write(gettext('HELLO_STRING_JS'));

当我运行 django-admin.py makemessages -d djangojs -l en 我得到

CommandError: errors happened while running msguniq

msguniq: error during the reading of "/Users/Saturnix/PycharmProjects/TranslationTest/MyApp/locale/djangojs.pot": No such file or directory

我该怎么办?

最佳答案

这个模糊的错误消息基本上意味着 makemessages 没有找到要翻译的内容。

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com