我想建立一个多语言的python程序。基于这些链接(1,2),我按照以下格式构建了我的程序
+---commandHandlers
| | agreements.py
| | basics.py
| | __init__.py
|
+---responseTexts
| | agreementResponces.py
| | basicResponces.py
| | __init__.py
| |
| +---locales
| | | default.pot
| | | ReadMe.md
| | |
| | \---fa
| | \---LC_MESSAGES
| | default.mo
| | default.po
我有两个问题
第一件事是每次我添加新的文本需要翻译,我应该使用以下命令,它破坏了我以前翻译的数据
cd responseTexts
xgettext -d default -o locales/default.pot basicResponces.py agreementResponces.py
cp locales/default.pot locales/fa/LC_MESSAGES/default.po
msgfmt -o locales/fa/LC_MESSAGES/default.mo locales/fa/LC_MESSAGES/default
我知道我可以复制粘贴新生成的文本,而不是使用cp
,但正如您所知,这是非常无聊和不合理的
我的第二个问题是如何更改default.pot的标题
"Content-Type: text/plain; charset=CHARSET\n"
至
"Content-Type: text/plain; charset=UTF-8\n"
什么
在我忘记之前,有没有什么方法可以在windows中把目录作为xgettext
的输入?因为吼叫命令对我不起作用
xgettext -d default -o locales/default.pot -D .
已更新
将msgmerge用作msgmerge locales/fa/LC_MESSAGES/default.po locales/default.pot > locales/fa/LC_MESSAGES/default.po
也不起作用:))
目前没有回答
相关问题 更多 >
编程相关推荐