sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Translated parsed-literals are incorrectly rendered

Open n-peugnet opened this issue 1 year ago • 12 comments

Describe the bug

When adding 'literal-block' to gettext_additional_targets option, parsed-literals are allowed to be translated.

However, when they are translated, they are incorrectly rendered.

I noticed this while working on #12277, and I intend to fix it as part of #12238.

How to Reproduce

Here is a failing test for this bug (it is based on #12277): https://github.com/n-peugnet/sphinx/compare/add-intl-tests...n-peugnet:sphinx:parsed-literal-i18n

Environment Information

Platform:              linux; (Linux-6.6.15-amd64-x86_64-with-glibc2.37)
Python version:        3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0])
Python implementation: CPython
Sphinx version:        7.3.0+/e352a675d
Docutils version:      0.19
Jinja2 version:        3.1.2
Pygments version:      2.17.2

Sphinx extensions

No response

Additional context

Current result: 2024-04-15-231801_680x141_scrot

Expected result: 2024-04-15-231825_677x131_scrot

n-peugnet avatar Apr 15 '24 21:04 n-peugnet

Ah, I only notice https://github.com/sphinx-doc/sphinx/issues/12278 now, as I was already working on this while it was posted.

n-peugnet avatar Apr 15 '24 21:04 n-peugnet

Hello, @n-peugnet

I think this issue and my issue #12278 are duplicates.

So it is indeed a bug from Sphinx itself, right?

hwhsu1231 avatar Apr 19 '24 07:04 hwhsu1231

Yes. Which one should I close then?

picnixz avatar Apr 19 '24 08:04 picnixz

@picnixz I have linked some issues and PR to this one so I would like to keep it open if possible.

n-peugnet avatar Apr 19 '24 08:04 n-peugnet

Yes. Which one should I close then?

I closed mine.

hwhsu1231 avatar Apr 19 '24 10:04 hwhsu1231

@hwhsu1231 could you try to compile your example docs with my branch to see if you detect any issues? You can install it with the following command (preferably in a virtual env):

pip install git+https://github.com/n-peugnet/sphinx@new-inline-parse-i18n-logic

n-peugnet avatar May 12 '24 09:05 n-peugnet

@hwhsu1231 could you try to compile your example docs with my branch to see if you detect any issues? You can install it with the following command (preferably in a virtual env):

pip install git+https://github.com/n-peugnet/sphinx@new-inline-parse-i18n-logic

Hello, @n-peugnet. It works!!!

Screenshot_20240513_005327

hwhsu1231 avatar May 12 '24 16:05 hwhsu1231

@hwhsu1231:

Hello, @n-peugnet. It works!!!

Great to hear! Could try to see if you spot any regression in your docs and if so, report it in the associated pull request https://github.com/sphinx-doc/sphinx/pull/12238?

n-peugnet avatar May 12 '24 20:05 n-peugnet

Hello, @n-peugnet

Great to hear! Could try to see if you spot any regression in your docs and if so, report it in the associated pull request #12238?

May I ask What you want me to do with the PR according to this description? (Be more specific)

What does "spot any regression in your docs" mean?

hwhsu1231 avatar May 20 '24 04:05 hwhsu1231

@hwhsu1231:

May I ask What you want me to do with the PR according to this description? (Be more specific)

What does "spot any regression in your docs" mean?

Sorry it was not very explicit. The branch I asked you to test in https://github.com/sphinx-doc/sphinx/issues/12287#issuecomment-2106190137 is a development branch where I rework the internals of Sphinx's translation workflow. It is a little bit experimental, and may introduce regressions, compared to the master branch.

As you are currently working on translating a large project, it could be interesting for me if you discover translation issues with this branch, that do not exist in the master branch. This way I can fix the issue in my branch and add a regression test to the testsuite, to make sure it does not break in the future.

n-peugnet avatar May 20 '24 11:05 n-peugnet

Hello, @n-peugnet

As you are currently working on translating a large project, it could be interesting for me if you discover translation issues with this branch, that do not exist in the master branch. This way I can fix the issue in my branch and add a regression test to the testsuite, to make sure it does not break in the future.

So basically, you want me to keep testing my project with the development branch that you gave me, and report any issue about this branch if found, right? (Since I've already tested my project with this branch in this comment, I just wonder whether you want me to do something else.)

If so, no problem!!

hwhsu1231 avatar May 20 '24 14:05 hwhsu1231

@hwhsu1231:

So basically, you want me to keep testing my project with the development branch that you gave me, and report any issue about this branch if found, right?

Exactly!

(Since I've already tested my project with this branch in this comment, I just wonder whether you want me to do something else.)

Not really, just keep using it, and if possible, if you find an issue, check that it does not also happens on master before reporting it.

If so, no problem!!

Thanks :)

n-peugnet avatar May 20 '24 14:05 n-peugnet