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

Normalization does not respect line number granularity #171

Open
mgeisler opened this issue Feb 6, 2024 · 5 comments
Open

Normalization does not respect line number granularity #171

mgeisler opened this issue Feb 6, 2024 · 5 comments

Comments

@mgeisler
Copy link
Collaborator

mgeisler commented Feb 6, 2024

As a side-quest ( 😄 ) to #154, I've realized that mdbook-i18n-normalize doesn't use the same rounding logic... that will come back and cause problems at some point.

It would be great to have it round the normalized message sources the same way.

@zachcmadsen
Copy link
Contributor

I'll pick this up since it's related to #154

@mgeisler
Copy link
Collaborator Author

Awesome, thanks @zachcmadsen!

@carreter
Copy link
Contributor

Notably mdbook-xgettext is also not respecting granularity for subchapters! It currently always includes line numbers when rendering messages in subchapters:

                let source = ctx.config.book.src.join(&source);
                for (lineno, extracted) in extract_messages(&content) {
                    let msgid = extracted.message;
                    let source = format!("{}:{}", source.display(), lineno);
                    add_message(catalog, &msgid, &source, &extracted.comment);
                }

Putting up a fix now.

@carreter
Copy link
Contributor

@mgeisler working on this now. How do we want the granularity to be configured? Should it be a command-line flag?

@mgeisler
Copy link
Collaborator Author

mgeisler commented Aug 8, 2024

@mgeisler working on this now. How do we want the granularity to be configured? Should it be a command-line flag?

Hmm, good question! I guess there are two options:

  • a command line flag, nice and simple
  • attempt to find an parse a book.toml file — that is where the configuration should be written in the first place. We can even call Config::from_disk from mdbook to do this.

If it's easy to replicate how mdbook loads the config, then can could be nice. If it's not super easy, then a command line flag would be great too.

@zachcmadsen zachcmadsen removed their assignment Aug 18, 2024
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

3 participants