【问题标题】:How to fix Django 'Can't find msguniq' error如何修复 Django 的“找不到 msguniq”错误
【发布时间】:2019-12-03 15:28:04
【问题描述】:

我尝试在我的 Django 项目中使用国际化

我遵循一个教程:https://www.youtube.com/watch?v=xI97sLMd1rM 但作者跳过了 gettext 的配置

我已经安装了gettext librairie,似乎没问题:xgettext --session in a prompt Confirm it is installed

我跟着教程的开始

settings.py

LOCALE_PATHS = [
    os.path.join(BASE_DIR,'locale'),
]

base.html

{% load static i18n %}
{% load static %} # don't know if should import twice static

test_translation.html

{% extends 'layouts/base.html' %}
{% load i18n %}
h2>{% trans "A test of translation" %}</h2>

但是,当我在我的环境中运行时

(env) PS myproject > django-admin makemessages -l fr

我收到以下错误:

CommandError:找不到 msguniq。确保您已安装 GNU gettext 工具 0.15 或更新版本。

我需要安装其他东西吗?

【问题讨论】:

    标签: django internationalization


    【解决方案1】:

    不知道为什么,但问题出在我尝试从我的 VS Code 控制台而不是提示控制台执行 django-admin makemessages -l fr...

    如果有人能解释我的不同之处,我将不胜感激......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-08
      • 2019-07-04
      • 2019-06-14
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      相关资源
      最近更新 更多