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

Skip large code blocks in Bare-metal Rust #1327

Closed
mgeisler opened this issue Oct 9, 2023 · 6 comments
Closed

Skip large code blocks in Bare-metal Rust #1327

mgeisler opened this issue Oct 9, 2023 · 6 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mgeisler
Copy link
Collaborator

mgeisler commented Oct 9, 2023

As part of #1257, we should skip the large and mostly untranslatable code blocks found in Bare-metal Rust.

To do this, simply add

<!-- mdbook-xgettext: skip -->

before the code block. Notice how the code disappears from messages.pot when you run

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

@qwandor, fyi.

@mgeisler mgeisler added good first issue Good for newcomers help wanted Extra attention is needed labels Oct 9, 2023
@0scvr
Copy link
Contributor

0scvr commented Oct 9, 2023

Please sign me up for this one, I'd like to give it a go.

@mgeisler
Copy link
Collaborator Author

Hi @0scvr, that's amazing! Thanks!

0scvr added a commit to 0scvr/comprehensive-rust that referenced this issue Oct 10, 2023
qwandor pushed a commit that referenced this issue Oct 11, 2023
…1339)

See #1327

Removes 280 lines from `messages.pot`.

Signed-off-by: 0scvr <[email protected]>
@mgeisler
Copy link
Collaborator Author

Should we close this now?

@0scvr
Copy link
Contributor

0scvr commented Oct 11, 2023

By replacing comments and strings inside the codeblocks we can probably improve this further but I don't think it's worth the effort, unless there's a real need. I think this can be closed for now.

@mgeisler
Copy link
Collaborator Author

By replacing comments and strings inside the codeblocks we can probably improve this further but I don't think it's worth the effort, unless there's a real need. I think this can be closed for now.

I have #531 as a long-shot approach for this: if we could get mdbook to show stderr, we could replace almost all println! calls with dbg!. That would eliminate most of the literal strings in our code examples and automatically remove the code blocks from the translations. Which would be a nice way to lower the burden on our translators.

But I agree, let's close this one now that you've cleaned up most of the strings. Thanks a lot!

@mgeisler
Copy link
Collaborator Author

That would eliminate most of the literal strings in our code examples and automatically remove the code blocks from the translations. Which would be a nice way to lower the burden on our translators.

I just remembered that we also have google/mdbook-i18n-helpers#95 which is a better long-term solution: we could only extract comments and literal strings from the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants