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

Implement #noqa for i18n #10107

Merged
merged 4 commits into from Mar 27, 2022
Merged

Implement #noqa for i18n #10107

merged 4 commits into from Mar 27, 2022

Conversation

jeanas
Copy link
Contributor

@jeanas jeanas commented Jan 16, 2022

Feature or Bugfix

Feature

Purpose

Allow warnings about inconsistent references in translated messages to be suppressed, either globally or for one translated message individually.

Detail

  • Use type and subtype when emitting these warnings, which allows to suppress them globally using the suppress_warnings configuration variable.
  • Recognize leading #noqa in translated message and do not warn if present.

Relates

#3985

@jeanas
Copy link
Contributor Author

jeanas commented Feb 11, 2022

Is there anything I can do to help this PR move forward?

@tk0miya tk0miya added type:enhancement enhance or introduce a new feature internals:internationalisation type:proposal a feature suggestion labels Feb 13, 2022
@tk0miya
Copy link
Member

tk0miya commented Feb 13, 2022

Reasonable. But I'm not sure which is a better prefix or suffix for the place of noqa. I usually use the magic comment at the tail of the line on python scripts. So I prefer placing it at the tail.

I'd like to hear the opinion from @shimizukawa too. Do you have any ideas?

This allows suppressing them using the suppress_warnings configuration
variable.
@jeanas
Copy link
Contributor Author

jeanas commented Feb 15, 2022

Thanks for your feedback, @tk0miya. I have updated this PR to place #noqa at the end.

When cross-references in the original paragraph and the translated
paragraph do not match, a warning is emitted.  It is useful, because
it allows to catch mistakes, but it can also be an annoyance since
sometimes it is expected that the cross-references will not match.
For example, a reference that is repeated in the original text may
need to be factored out for good style in the target language.
Another example: if the translator needs to translate a universally
understood term in the source language into a term that not everyone
knows is the translation of this original term, adding a reference to
the glossary can be warranted.  This allows the translated message to
start with '#noqa' in order to disable the warning.
@jeanas
Copy link
Contributor Author

jeanas commented Feb 27, 2022

Gentle ping, @shimizukawa, @tk0miya?

Copy link
Member

@shimizukawa shimizukawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no objection to the method of adding #noqa to msgstr.
Indeed, I think that is the only place in the po file where we can specify that; the method of writing it on the comment line, like fuzzy, is not likely to be controlled by services such as transifex.

doc/usage/advanced/intl.rst Outdated Show resolved Hide resolved
doc/usage/configuration.rst Outdated Show resolved Hide resolved
@tk0miya tk0miya added this to the 4.5.0 milestone Mar 27, 2022
@tk0miya tk0miya merged commit b20e049 into sphinx-doc:4.x Mar 27, 2022
@tk0miya
Copy link
Member

tk0miya commented Mar 27, 2022

Just merged. Thank you for your contribution!

tk0miya added a commit that referenced this pull request Mar 27, 2022
@jeanas
Copy link
Contributor Author

jeanas commented Mar 27, 2022

Thanks a lot for merging!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2022
@jeanas jeanas deleted the intl-warnings branch May 31, 2023 10:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
internals:internationalisation type:enhancement enhance or introduce a new feature type:proposal a feature suggestion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants