You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe. #2874 described reasons why .. only:: should be ignored in gettext builder and #2878 implemented that. I see two issues with that:
This behavior is not documented (besides note in changelog entry from 2016).
This makes it impossible to exclude certain content from being localized.
Describe the solution you'd like
Let's take this rst:
.. only:: not gettext
Content not to be localized.
.. only:: html
Content to be localized.
I'd like the first block not to be extracted and the second one to be.
Describe alternatives you've considered
Any other syntax for excluding content from the generated POT file would do the job as well. Looking at the documentation the obvious way would be using .. only:: and its documentation does not contain any mention that it does not work with the gettext builder.
The text was updated successfully, but these errors were encountered:
There is nothing to translate there, so let's exclude them from
translation.
This needs a bit hacking with Sphinx for now as there doesn't seem to be
a native way to achieve the exclusion, see
sphinx-doc/sphinx#13307.
importsphinx.builders.gettextfromsphinx.util.tagsimportTagsclassWeblateTags(Tags):
defeval_condition(self, condition):
# Exclude blocks marked as not gettextreturncondition!="not gettext"defsetup(app) ->None:
# Monkey path gettext build tags handling, this is workaround until# https://github.com/sphinx-doc/sphinx/issues/13307 is addressed.sphinx.builders.gettext.I18nTags=WeblateTags
It is definitely not something ready for the inclusion as the text comparing is fragile, but doing something similar and more robust in _eval_node should be doable. I can contribute a PR if this is something acceptable.
nijel
added a commit
to WeblateOrg/weblate
that referenced
this issue
Feb 6, 2025
There is nothing to translate there, so let's exclude them from
translation.
This needs a bit hacking with Sphinx for now as there doesn't seem to be
a native way to achieve the exclusion, see
sphinx-doc/sphinx#13307.
Is your feature request related to a problem? Please describe.
#2874 described reasons why
.. only::
should be ignored in gettext builder and #2878 implemented that. I see two issues with that:Describe the solution you'd like
Let's take this rst:
I'd like the first block not to be extracted and the second one to be.
Describe alternatives you've considered
Any other syntax for excluding content from the generated POT file would do the job as well. Looking at the documentation the obvious way would be using
.. only::
and its documentation does not contain any mention that it does not work with the gettext builder.The text was updated successfully, but these errors were encountered: