Django版本1.3 pre alpha SVN-13858
Ubuntu GNU/Linux 10.10版
我对Django中的i18n和l10n是完全陌生的,目前我正在尝试用荷兰语(除了默认语言:英语)提供Django项目。我试着运用在会议上给出的指示
http://docs.djangoproject.com/en/dev/topics/i18n/translation/
和
http://www.djangobook.com/en/2.0/chapter19/
但我没有成功。我不知道这是否与我的目录结构和模板文件在一个完全不同的目录中有关(我的意思不是作为mydjango项目目录中的子目录)。我的项目目录如下所示:
/home/emre/mydjango/myproject
/home/emre/mydjango/myproject/myapp1
/home/emre/mydjangotemplates
/home/emre/mydjangotemplates/myapp1
在myproject和myapp1目录中,我尝试发出以下命令:
django-admin.py makemessages -l nl
Error: This script should be run from the Django SVN tree or your project or
app tree. If you did indeed run it from the SVN checkout or your project or
application, maybe you are just missing the conf/locale (in the django tree)
or locale (for project and application) directory? It is not created automatically,
you have to create it by hand if you want to enable i18n for your project or
application.
所以我试着创造
区域设置
myproject和myapp1目录中的目录。之后,我再次发出上述命令(一次在项目中,一次在应用程序目录中),这次没有任何错误或警告,它说:
processing language nl
我检查了区域设置目录,发现它们填充了子目录,但根本没有任何.po文件:
$ tree
.
`-- nl
`-- LC_MESSAGES
2 directories, 0 files
我错过了什么?我应该调用django吗-管理员.py使用不同参数的makemessages命令?为什么Django不创建.po文件,即使我的.html模板文件中有一些文本需要翻译?