python - Django 翻译:找不到 msguniq
问题描述
我想在 Django 应用程序中进行翻译。
我正在关注本教程,但遇到了问题。
在我运行代码之后
python manage.py makemessages -l 'de'
我得到错误
CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
奇怪的是,我已经安装了 gettext
Warning: gettext 0.19.8.1 is already installed and up-to-date
To reinstall 0.19.8.1, run `brew reinstall gettext`
我将设置设置为:
# Translations
# Provide a lists of languages which your site supports.
LANGUAGES = (
('en', _('English')),
('de', _('German')),
)
# Set the default language for your site.
LANGUAGE_CODE = 'en'
# Tell Django where the project's translation files should be.
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
print(LOCALE_PATHS)
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
有谁知道会出什么问题?
解决方案
检查是否可以msguniq
手动运行:
$ msguniq --help
如果这给您一个 command not found 错误,请确保PATH
为 brew 正确设置了环境变量。
推荐阅读
- c# - 如何通过扩展中的 PXActions 正确地将记录添加到 DAC
- python-3.x - 如何替换字符串中的十六进制值
- c++ - 有没有办法解决这个错误:'operator[]' 不匹配(操作数类型是 'empl' 和 'int')
- c# - 在 NHibernate 查询中实现条件的更好方法是什么?
- centreon-api - 是否有可能通过 CLI 而不是通过 Web 界面进行配置来安装 Centreon?
- vba - 使用 VBA 格式化 PowerPoint 表格非常慢
- vsto - 插件无法在 Outlook 中看到
- angular - 启动画面不会隐藏在设备上的 --prod 模式中
- azure - 从追加 Blob 复制到 BlockBlob
- youtube - 有没有办法以编程方式下载 mp4 格式的 youtube 视频?