cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Exclude include in `reference/grammar.rst` in gettext builds

Open StanFromIreland opened this issue 9 months ago β€’ 14 comments

The include is too big (one string) and translations leave it untranslated.


πŸ“š Documentation preview πŸ“š: https://cpython-previews--133868.org.readthedocs.build/

StanFromIreland avatar May 11 '25 07:05 StanFromIreland

This will exclude any other formats -- text, or any custom/future one. Do you know why something like not gettext doesn't work?

encukou avatar May 12 '25 06:05 encukou

I tried not gettext and it did not work unfortunately. (Previous commit)

StanFromIreland avatar May 12 '25 06:05 StanFromIreland

Is it because not isn't supported, or because gettext isn't the right tag?

encukou avatar May 12 '25 09:05 encukou

Is it because not isn't supported, or because gettext isn't the right tag?

.. only:: gettext works as expected, so it must be the first.

StanFromIreland avatar May 12 '25 15:05 StanFromIreland

The only directive doesn't seem to support not logical operator, according to the docs and the source code.

rffontenelle avatar May 13 '25 02:05 rffontenelle

not is supported. This doesn't feel like the right solution, though.

AA-Turner avatar May 13 '25 08:05 AA-Turner

That's odd, it must be bugged then, not gettext did not work.

StanFromIreland avatar May 13 '25 15:05 StanFromIreland

This doesn't feel like the right solution, though.

I second that. The grammar contains many comments, which definitely would be helpful if translated. In my opinion we should split the grammar include for gettext builder by every double newline character. This could be controlled as an option in the literalinclude directive (or a default)? This would make the translatable units sections smaller.

m-aciek avatar May 14 '25 07:05 m-aciek

IMO even if we do it should not be prioritised. If someone is reading the grammar, they should probably know English.

There are a few hundred lines, we won’t translate error messages or var names anyway, is there really a point?

StanFromIreland avatar May 14 '25 07:05 StanFromIreland

I see it being similar to code snippets – we should translate only comments here. As we don't have a way to parse what's comment and what's not, to allow the comments translation we should allow translation of the whole grammar content. I agree it's not a priority from whole translation perspective.

m-aciek avatar May 14 '25 07:05 m-aciek

Note that many comments here mention features that this version of the Grammar omits.

IMO, we should copy any relevant comments to the preceding note, or preceding chapters (many of them are already there!), and then remove the comments altogether.

encukou avatar May 14 '25 08:05 encukou

Thinking further about this, currently translating it is a poor time investment since the translation is invalidated every week when the file changes.

I propose to for now, exclude it so that people do not spend time translating it. And, if we do want to translate it, a process which will need some discussion be devised elsewhere.

IMO, we should copy any relevant comments to the preceding note, or preceding chapters (many of them are already there!), and then remove the comments altogether.

That seems like something for your stream:-)

StanFromIreland avatar Jun 27 '25 15:06 StanFromIreland

@StanFromIreland After your last comment, I'm unclear what you think the next step for this PR should be. Close? Modify? Keep as is? Thanks.

willingc avatar Jun 27 '25 16:06 willingc

I think we need to action now, because there are people translating now.

The fastest/easiest approach is to remove it (which would be this pr), a long term fix can then be worked out.

StanFromIreland avatar Jun 27 '25 16:06 StanFromIreland

Per this Sphinx issue https://github.com/sphinx-doc/sphinx/issues/11787, it seems there is no better way to exclude something currently.

StanFromIreland avatar Sep 19 '25 17:09 StanFromIreland

I'll close this as I don't think it's the right approach. It might be that we need to make changes in Sphinx (per the linked issue), or something like ifconfig could work (untested).

A

AA-Turner avatar Sep 21 '25 10:09 AA-Turner

The Sphinx issue has been open for two years, I worry it is not going to be closed any time soon:-(

To at least save Transifex translators from this trap, I think we can add this message to our exclusion list.

StanFromIreland avatar Sep 21 '25 10:09 StanFromIreland