Skip to content

The v0.5.0-alpha.1 version of mdBook is incompatible with mdbook-i18n-helpers #2835

@hwhsu1231

Description

@hwhsu1231

Problem

Hello, mdBook Maintainance Team,

Recently, I tried to use mdbook-i18n-helpers to extract translatable strings from the mdBook documentation on the master branch. However, I encountered an error when generating the .pot files using the xgettext renderer. The error message is as follows:

thread 'main' panicked at crates/mdbook-core/src/config.rs:184:41:
unreachable: invalid key `output`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It seems that there's a breaking change causing this issue somewhere between the v0.4.52 tag and the latest commit on the master branch. I can confirm this because the following steps work fine with the v0.4.52 tag.

Steps

Run the following commands to reproduce the issue on the master branch:

Click to expand the commands
# Prepare Environment
MDBOOK_VERSION=master
git clone --branch=${MDBOOK_VERSION} --depth=1 https://github.com/rust-lang/mdBook.git mdbook-${MDBOOK_VERSION}
cd mdbook-${MDBOOK_VERSION}
conda create --prefix ./.conda --yes
conda activate ./.conda
conda install conda-forge::rust --channel conda-forge --yes
export CARGO_INSTALL_ROOT=$(pwd)/.conda
cargo install --path . --locked
cargo install mdbook-i18n-helpers

# Build with mdbook-i18n-helpers
export MDBOOK_OUTPUT='{"xgettext": {"depth": 5}}'
mdbook build $(pwd)/guide --dest-dir $(pwd)/guide/locale/pot

The full log: log-build-docs-on-master-branch.txt

As a comparison, run the same commands with the v0.4.52 tag:

Click to expand the commands
# Prepare Environment
MDBOOK_VERSION=v0.4.52
git clone --branch=${MDBOOK_VERSION} --depth=1 https://github.com/rust-lang/mdBook.git mdbook-${MDBOOK_VERSION}
cd mdbook-${MDBOOK_VERSION}
conda create --prefix ./.conda --yes
conda activate ./.conda
conda install conda-forge::rust --channel conda-forge --yes
export CARGO_INSTALL_ROOT=$(pwd)/.conda
cargo install --path . --locked
cargo install mdbook-i18n-helpers

# Build with mdbook-i18n-helpers
export MDBOOK_OUTPUT='{"xgettext": {"depth": 5}}'
mdbook build $(pwd)/guide --dest-dir $(pwd)/guide/locale/pot

The full log: log-build-docs-on-v0.4.52-tag.txt

Possible Solution(s)

I have no idea. I just hope that maintainers can consider compatibility with mdbook-i18n-helpers when developing the 0.5 version or newer versions.

Notes

Commits between the v0.4.52 tag and the latest commit of the master branch:

v0.4.52...166a972

Version

Print the version of mdbook and mdbook-i18n-helpers by the following commands:

conda activate $(pwd)/.conda
export CARGO_INSTALL_ROOT=$(pwd)/.conda
cargo install --list

For the master branch:

mdbook v0.5.0-alpha.1 (/media/hwhsu1231/KubuntuData/Repo/testing/mdbook-master):
    mdbook
mdbook-i18n-helpers v0.3.6:
    mdbook-gettext
    mdbook-i18n-normalize
    mdbook-xgettext

For the 0.4.52 tag:

mdbook v0.4.52 (/media/hwhsu1231/KubuntuData/Repo/testing/mdbook-v0.4.52):
    mdbook
mdbook-i18n-helpers v0.3.6:
    mdbook-gettext
    mdbook-i18n-normalize
    mdbook-xgettext

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: A bug, incorrect or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions