Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated po files contain unexpected changes #36

Open
greyli opened this issue May 27, 2021 · 10 comments
Open

Updated po files contain unexpected changes #36

greyli opened this issue May 27, 2021 · 10 comments

Comments

@greyli
Copy link
Member

greyli commented May 27, 2021

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 as msgid.
  • The msgid of alt of images was replaced with the translated msgstr.
  • 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.

@frostming
Copy link
Collaborator

第一个问题,都是一些api doc中的必备词汇,猜测是sphinx-intl 自动转换免去翻译了(渲染结果验证)
第二个问题我这里没有出现
第三个问题不影响渲染结果

所以总体上是没有大问题,请问你第一次po是如何生成的呢?用的同样的工具不应该结果有异

@greyli
Copy link
Member Author

greyli commented May 27, 2021

前两个问题不大,第三个比较麻烦,虽然不影响渲染,但是它会产生很多不必要的变动。如果后续引入 pre-commit 的话会导致冲突(pre-commit 把所有行长度调整好,更新 po 文件后又被打乱) 。

生成工具没变,命令也没变。

我看下有没有方法解决,没办法的话就只能放弃引入 pre-commit 了。

@frostming
Copy link
Collaborator

或者在workflow里跑一遍pre-commit

@greyli
Copy link
Member Author

greyli commented May 27, 2021

GitHub Actions 里的 git commit 会触发 pre-commit 吗?如果不会那就加一条 pre-commit 命令就好了。

或者在workflow里跑一遍pre-commit

对,发完才看到新评论……

@frostming
Copy link
Collaborator

是的,显式运行pre-commit

@greyli
Copy link
Member Author

greyli commented May 27, 2021

嗯,不过暂时还不清楚怎么让 pre-commit 检查 po 文件。我先去 https://github.com/sphinx-doc/sphinx-intl 发个 issue 问下输出混乱的问题。

ref: sphinx-doc/sphinx-intl#50

@frostming
Copy link
Collaborator

frostming commented May 28, 2021

第三个问题,最大行长是默认76的,PR中的行长也没有突破这个值,所以折行稳定性是可以保证的

@greyli
Copy link
Member Author

greyli commented May 28, 2021

第三个问题,最大行长是默认76的,PR中的行长也没有突破这个值,所以折行稳定性是可以保证的

设置行长只会控制 msgid 的长度。在那个 PR 里,这一行的长度是 139。我认为更新 po 文件不该变动 msgstr 的值,不过似乎没有提供相应的设置选项。

@frostming
Copy link
Collaborator

frostming commented May 28, 2021

看明白了,仿佛它不能正确在中文字符内折行,似乎应该报告给Babel

Update: python-babel/babel#787

@rosekc

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants