我尝试在Django中实现Internationalize 我在这里遵循了这个教程:https://medium.com/@nolanphillips/a-short-intro-to-translating-your-site-with-django-1-8-343ea839c89b
但是当我执行“python manage.py makemessage -l en”命令时,我得到了类似下面的UnicodeDecodeError “UnicodeDecodeError:'ascii'编解码器无法解码位置1中的字节0xe9:序数不在范围内(128)”
我还尝试将bashrc和环境文件中的语言环境设置更改为:
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
但没有运气,错误仍然存在
有什么想法吗?谢谢
答案 0 :(得分:0)
感谢您的时间。这是makemessages的输出:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemessages.py", line 326, in handle
potfiles = self.build_potfiles()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemessages.py", line 356, in build_potfiles
file_list = self.find_files(".")
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemessages.py", line 411, in find_files
for dirpath, dirnames, filenames in os.walk(root, topdown=True, followlinks=self.symlinks):
File "/usr/lib/python2.7/os.py", line 286, in walk
if isdir(join(top, name)):
File "/usr/lib/python2.7/posixpath.py", line 80, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 1: ordinal not in range(128)