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

po4a should validate the msgstr wrt the target format #290

Open
mariobl opened this issue Jan 30, 2021 · 6 comments
Open

po4a should validate the msgstr wrt the target format #290

mariobl opened this issue Jan 30, 2021 · 6 comments

Comments

@mariobl
Copy link

mariobl commented Jan 30, 2021

Hello,

po4a is used in the procps-ng project for maintaining the man page translations [1]. Recently some wrong formatting in the .po files has been encountered which breaks the build [2]. Such things can't be detected using »msgfmt -vc«. It would be useful to have a special validation tool for .po files based on po4a. This tool could be integrated into the workflow of the GNU TP robot, and in a case when a uploaded file is not canonically formatted, the robot would refuse it.

[1] http://translationproject.org/domain/procps-ng-man.html
[2] https://gitlab.com/procps-ng/procps/-/issues/188

@mquinson
Copy link
Owner

Hello Mario,

I must say that I'm not sure of what you are asking for. It seems to me that the PO file was actually correct but that using it to translate lead to a failure. Not because of the PO formating, but because of the content in the translated strings. Am I right?

If so, I think that the problem is that your build infrastructure not always try to use the content of the po files when these files change. Using po4a(1) instead of the atomic scripts such as po4a-translate may help here (and if not that would be a bug about which I'd knew what to do).

Right now, the only thing I can think of would be a --dry-run flag to the po4a tools. That's about the best validation tool I can think of, if you really don't want to modify the translated files on disk.

Please don't hesitate to elaborate if I missed something.

@mariobl
Copy link
Author

mariobl commented Jan 30, 2021

Thanks for the quick reply. No, the .po file wasn't correct. It's mostly about unbalanced <> or even <> where it is B<> in msgid, for example. Such mistakes aren't detected by msgfmt -vc which is used by the TP robot. Your assumption is right, that the .po file was correct in terms of msgfmt, but not in the B<>, I<> or whatever Perldoc-like formatting.

Indeed, an option like --dry-run would be nice to have. But currently it is most important for po4a-translate, for use cases, where the master document is not available directly. So this need to be still implemented... Is there any workaround to use the current po4a-translate for this purpose, maybe a dummy master.dok, writing the output to /dev/null?

@mquinson
Copy link
Owner

mquinson commented Nov 7, 2021

Hello,

I think that the best thing would be to simply run po4a in the TP-robot workflow whenever a po file is modified. I think that you don't even need the --dry-run flag for such a usecase, do you? What advantage would you gain from that option in this case?

Thanks,
Mt

@mquinson
Copy link
Owner

mquinson commented Jul 9, 2022

Hello @mariobl,

I still think that simply running po4a would do the trick for you, and that there is little to no use for a --dry-run flag. Since you didn't answer, I'm assuming that you agree with me. If not, please feel free to reopen the bug.

@mquinson mquinson closed this as completed Jul 9, 2022
@jnavila
Copy link
Collaborator

jnavila commented Jul 11, 2022

There's still something to dig here. As we pass the file format to po4a, it should be able to provide some basic checks on the content of translation.

Right now the po file can be totally correct in format, but the content be wrong with respect to the end format.

For instance, for asciidoc, it could detect inline formatting sequences in the original string and check that these formatting sequences are present and complete in the resulting strings.

@mquinson
Copy link
Owner

Ok, reopening + retitle.

@mquinson mquinson reopened this Jul 11, 2022
@mquinson mquinson changed the title Validation tool for translations? po4a should validate the msgstr wrt the target format Jul 11, 2022
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