google / mdbook-i18n-helpers

Translation support for mdbook. The plugins here give you a structured way to maintain a translated book.
Apache License 2.0
130 stars 25 forks source link

Normalization does not respect line number granularity #171

Open mgeisler opened 8 months ago

mgeisler commented 8 months ago

As a side-quest ( :smile: ) 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 commented 7 months ago

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

mgeisler commented 7 months ago

Awesome, thanks @zachcmadsen!

carreter commented 2 months ago

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 commented 2 months ago

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

mgeisler commented 1 month ago

@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:

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.