godotengine / godotengine/godot-docs
Write script to validate hyperlinks in docs translation
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
This is mainly needed for https://github.com/godotengine/godot-docs-l10n but that repo is mostly used for practical reasons, actually discussion should likely happen here.
I've noticed that in our docs translations, it's common to find broken links, e.g.:


In the above two examples, that's due either to formatting issues (Japanese doesn't separate words with spaces, but reST seems to require a space after the trailing `_` of an external link) or translator mistake due to not being familiar with the markup (the French translator simply removed the markup).
I guess Sphinx might be able to warn about some of these, but likely not all cases (e.g. the French example above would not be seen as invalid formatting).
I think the best would be to have a script (likely in Python) that I could use to go over all `.po` files in https://github.com/godotengine/godot-docs-l10n/tree/master/weblate to find such formatting issues or mismatches between source string `msgid` and translation `msgstr`.
For mismatches, it could be that gettext already has a feature for that, though I'm not sure it would support reST-specific markup (it does have a feature to warn about mismatch in trailing spaces or newlines for example).
`.po` files are wrapped, so to parse the markup properly the parser should be able to unwrap the lines and consider the whole string. It could then also be used on the `.pot` template to check for badly formatted links in the English source.
Any Python and parser-loving volunteer? :P
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.