flask-docs-zh
flask-docs-zh copied to clipboard
Updated po files contain unexpected changes
I tried to update .po files based on the updates from the upstream repo. However, the changes contain a lot of unexpected results:
- Some Chinese words added into
api.po
asmsgid
. - The
msgid
of alt of images was replaced with the translatedmsgstr
. - Some multiline
msgstr
was reordered based on the position of the English word.
We need to fix this issue before running the sync workflow.
See the changes in https://github.com/greyli/flask-docs-zh/pull/35/files.
第一个问题,都是一些api doc中的必备词汇,猜测是sphinx-intl 自动转换免去翻译了(渲染结果验证) 第二个问题我这里没有出现 第三个问题不影响渲染结果
所以总体上是没有大问题,请问你第一次po是如何生成的呢?用的同样的工具不应该结果有异
前两个问题不大,第三个比较麻烦,虽然不影响渲染,但是它会产生很多不必要的变动。如果后续引入 pre-commit 的话会导致冲突(pre-commit 把所有行长度调整好,更新 po 文件后又被打乱) 。
生成工具没变,命令也没变。
我看下有没有方法解决,没办法的话就只能放弃引入 pre-commit 了。
或者在workflow里跑一遍pre-commit
GitHub Actions 里的 git commit 会触发 pre-commit 吗?如果不会那就加一条 pre-commit 命令就好了。
或者在workflow里跑一遍pre-commit
对,发完才看到新评论……
是的,显式运行pre-commit
嗯,不过暂时还不清楚怎么让 pre-commit 检查 po 文件。我先去 https://github.com/sphinx-doc/sphinx-intl 发个 issue 问下输出混乱的问题。
ref: https://github.com/sphinx-doc/sphinx-intl/issues/50
第三个问题,最大行长是默认76的,PR中的行长也没有突破这个值,所以折行稳定性是可以保证的
第三个问题,最大行长是默认76的,PR中的行长也没有突破这个值,所以折行稳定性是可以保证的
设置行长只会控制 msgid 的长度。在那个 PR 里,这一行的长度是 139。我认为更新 po 文件不该变动 msgstr 的值,不过似乎没有提供相应的设置选项。
看明白了,仿佛它不能正确在中文字符内折行,似乎应该报告给Babel
Update: https://github.com/python-babel/babel/issues/787