当我运行这个命令时:
它会报错:
我已经有一个包含一些需要翻译的 Ar 语言的 .po 文件了,我在两个月前就已经创建好并且已经翻译完毕。
但是当我运行 makemessages 命令来添加新的需要翻译的文本时,它会出现上述错误。
请问有任何想法吗?
django-admin makemessages -l ar
它会报错:
Traceback (most recent call last):
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\utils\encoding.py", line 65, in force_text
s = str(s, encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 3107: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Ahmed\AppData\Local\Programs\Python\Python36-32\Scripts\django-admin.exe\__main__.py", line 9, in <module>
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site- packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site- packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\commands\makemessages.py", line 384, in handle
potfiles = self.build_potfiles()
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\commands\makemessages.py", line 426, in build_potfiles
self.process_files(file_list)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\commands\makemessages.py", line 522, in process_files
self.process_locale_dir(locale_dir, files)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\commands\makemessages.py", line 590, in process_locale_dir
msgs, errors, status = popen_wrapper(args)
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\utils.py", line 23, in popen_wrapper
force_text(output, stdout_encoding, strings_only=True, errors='strict'),
File "c:\users\ahmed\appdata\local\programs\python\python36-32\lib\site-packages\django\utils\encoding.py", line 69, in force_text
raise DjangoUnicodeDecodeError(s, *e.args)
django.utils.encoding.DjangoUnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 3107: invalid continuation byte. You passed in
除了错误外,每个html文件都会创建一个 html.py
文件。例如:对于 index.html
,在模板文件夹中将创建一个 index.html.py
。这些 html.py
文件只包含“X”和“B”字符以及一些需要翻译的文本。
例如:
BBBBBBBB
BBBBB BBBBBBB
XXXX XXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXX XXXXX XXX
XXXX XXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXX XX
XXX XXXXXXXXXXXXXX gettext(u'Les appels à projet') XXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX
XXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XXXXXXX
XXXX
XXXX gettext(u'Appel à projet') XXXXX
XXXX gettext(u'Date de lencement') XXXXX
XXXX gettext(u'Date de clature') XXXXX
XXXX gettext(u'Année budjitaire') XXXXX
XXXX gettext(u"N° d'apppel à projet") XXXXX
XXXX gettext(u"Etat d'appel") XXXXX
XXXX XXXX gettext(u'Action') XXXXX XXX
XXXXX
XXXXXXXX
XXXXXXX
BBB BBBBBB BB BBBBBBBBBBB
XXXX
XXXXXXXXX
XXXXXXXXX
XXXXXXXXX
我已经有一个包含一些需要翻译的 Ar 语言的 .po 文件了,我在两个月前就已经创建好并且已经翻译完毕。
但是当我运行 makemessages 命令来添加新的需要翻译的文本时,它会出现上述错误。
请问有任何想法吗?
.html.py
或.txt.py
扩展名的文件是临时文件,并且通常在makemessages
运行期间自动删除。看起来这些异常导致了临时文件的清理失败。 - jnns