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

Error when internationalizing documentation using sphinx and nbsphinx #727

Open
iamdalio opened this issue Apr 26, 2023 · 3 comments
Open

Comments

@iamdalio
Copy link

iamdalio commented Apr 26, 2023

Describe the bug

When attempting to internationalize Sphinx documentation that contains ipynb files using the make -e SPHINXOPTS="-D language='de'" html command, the following error occurs:

  docs/ecosystem/aim_tracking.ipynb:7: ERROR: Unexpected indentation.

How to Reproduce

  1. clone doc files
    git clone https://github.com/hwchase17/langchain.git
  2. cd langchain/docs
  3. Add configurations to conf.py.
    locale_dirs = ['locale/'] # path is example but recommended.
  4. make gettext
  5. sphinx-intl update -p _build/gettext -l de
  6. Translate po files. **Notice: modify msgstr in ipynb files **
#: ../../ecosystem/aim_tracking.ipynb:10002
msgid "Aim"
msgstr "Aim dasd 11"
  1. make -e SPHINXOPTS="-D language='de'" html

Environment Information

Platform:              darwin; (macOS-13.1-x86_64-i386-64bit)
Python version:        3.10.8 (main, Oct 13 2022, 10:17:43) [Clang 14.0.0 (clang-1400.0.29.102)])
Python implementation: CPython
Sphinx version:        6.2.1
Docutils version:      0.19
Jinja2 version:        3.1.2
Pygments version:      2.14.0

Sphinx extensions

extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.autodoc.typehints",
    "sphinx.ext.autosummary",
    "sphinx.ext.napoleon",
    "sphinx.ext.viewcode",
    "sphinxcontrib.autodoc_pydantic",
    "nbsphinx",
    "sphinx_copybutton",
    "sphinx_panels",
    "IPython.sphinxext.ipython_console_highlighting",
]
@mgeier
Copy link
Member

mgeier commented Apr 27, 2023

Thanks for reporting this!

I have never used Sphinx internationalization myself, but I remember an issue a few years ago (#154) which seems to have been solved with #156. After that, I haven't heard about any problems, but maybe nobody has used it since then?

Anyway, I tried to reproduce, but the dependencies of the example project made it too cumbersome for me.

Can you please provide a minimal reproducible example?

@iamdalio
Copy link
Author

@mgeier
Thanks for your response. I did some debugging and it seems that there is an issue with the internationalization logic in Sphinx. The MD and RST files are ok , but processing the internationalization logic for the IPYNB files which are in JSON format generates error.I will contact the Sphinx team and let them know.
nbsphinx is a great project, thank you.

@mgeier
Copy link
Member

mgeier commented Apr 28, 2023

I don't think we should bother the Sphinx team at this point, I have the feeling that we can solve this on the nbsphinx side.

If you help me reproduce the problem, I can try to find the root cause and hopefully fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants