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

'duplicate message definition' in .pot generated by Sphinx's 'gettext' builder #13168

Open
hwhsu1231 opened this issue Dec 6, 2024 · 0 comments
Labels

Comments

@hwhsu1231
Copy link

hwhsu1231 commented Dec 6, 2024

Describe the bug

Recently, I attempted to generate the conf.py file for a Jupyter Book project using jupyter-book, and then used sphinx-build with the gettext builder to create .pot files. Initially, I thought there were no errors. However, when I executed the msgcat command to process the generated .pot files, some of them showed errors like the following:

(/home/hwhsu1231/Repo/testing/jupyter-book/.venv) hwhsu1231@vb-kubuntu:~/Repo/testing/jupyter-book/docs$ msgcat --lang=zh_TW  --width=79 --output-file=locale/zh_TW/advanced/index.po locale/pot/advanced/index.pot
locale/pot/advanced/index.pot:20: duplicate message definition...
locale/pot/advanced/index.pot:8: ...this is the location of the first definition
msgcat: found 1 fatal error

After opening locale/pot/advanced/index.pot file, we can see that there are indeed two entries with the same location, #: ../../advanced/index.md:1:

Click to expand the output
(/home/hwhsu1231/Repo/testing/jupyter-book/.venv) hwhsu1231@vb-kubuntu:~/Repo/testing/jupyter-book/docs$ cat locale/pot/advanced/index.pot
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2023
# This file is distributed under the same license as the Project name not set package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Project name not set \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-06 11:00+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../advanced/index.md:1
msgid ""
msgstr ""

#: ../../advanced/index.md:1
msgid "Advanced Jupyter Book Usage"
msgstr ""

#: ../../advanced/index.md:3
msgid "These sections cover a few ways to customize and configure Jupyter Book that require extra knowledge about the Sphinx ecosystem, more challenging workflows, etc."
msgstr ""

How to Reproduce

Run the following commands in order:

git clone --branch=v1.0.3 --depth=1 https://github.com/jupyter-book/jupyter-book.git
cd jupyter-book
conda create --prefix ./.venv --channel conda-forge --yes
conda activate ./.venv
conda install python=3.11 --channel conda-forge --yes
export LANG=en_US.UTF-8
export PYTHONNOUSERSITE=1
pip install .[sphinx] --progress-bar=off
cd docs
jupyter-book config sphinx .
sphinx-build -b gettext -j 4 -D gettext_compact=0 -c . . locale/pot
mkdir -p locale/zh_TW/advanced
msgcat --lang=zh_TW  --width=79 --output-file=locale/zh_TW/advanced/index.po locale/pot/advanced/index.pot
cat locale/pot/advanced/index.pot

log-jupyter-book-sphinx-build-msgcat.txt

Environment Information

Platform:              linux; (Linux-6.8.0-49-generic-x86_64-with-glibc2.39)
Python version:        3.11.11 | packaged by conda-forge | (main, Dec  5 2024, 14:17:24) [GCC 13.3.0])
Python implementation: CPython
Sphinx version:        7.4.7
Docutils version:      0.20.1
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

No response

Additional context

I believe this should be a bug because, so far, I have tested many Sphinx-based documents, and their .pot files generated using the 'gettext' builder have never had this issue.

However, I am not sure which tool this bug belongs to: Sphinx? MyST-Parser? Jupyter-Book? Gettext?

Therefore, I decided to report this issue to the Sphinx team first, hoping they can check whether it is a bug in Sphinx.

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

No branches or pull requests

1 participant