Skip to content

Add support for configuration options #200

@mgeisler

Description

@mgeisler

For Comprehensive Rust, we use a granularity: 0 setting when extracting messages with mdbook-xgettext. This avoids churn in the line numbers.

However, it happens regularly (google/comprehensive-rust#2100, google/comprehensive-rust#1991, google/comprehensive-rust#1950, ...) that people forget to use this setting.

I would love to have a way of specifying the right settings in a configuration file. Something which can turn

MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' \
  mdbook build -d po

into just

mdbook build -d po

or similar.

We could already store the options in our book.toml file today. The reason we don't do this is that this would enable the xgettext output unconditionally for everybody.

Some ideas for solving this:

  • Make mdbook-xgettext required and enabled in every execution. This would be a little wasteful, but it might not matter if it's quick enough? Measure this to get some data.
  • Make mdbook-xgettext optional with optional: true in book.toml. Make it exit early when it sees that it's optional. If this works well, we could use it for the mdbook-pandoc output too. See Pandoc failure during local rendering comprehensive-rust#1911 for a recent example of it failing.
  • Write a small wrapper and ask people to run that instead of calling mdbook-xgettext directly using the above config hack.
  • Other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions