-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Make "Speaker Notes" translatable #1390
Comments
Hello @mgeisler !! |
Hi @Sweetdevil144, it is open! Please go ahead and propose a plan for how we can do this. |
Hello @mgeisler , What are your views on this? |
Yeah, I think we should find a way to inject the string "Speaker Notes" into the PO files we already use to translate the course. We have a translation pipeline set up for the course and we should try to build on it. The translation work by
See TRANSLATIONS.md for the details and see mdbook-i18n-helpers for the tooling. Now, how do speaker notes work? They work purely using JavaScript, see speaker-notes.js. The code looks for a To make something appear in the PO files, it needs to be part of the pages when the Asking people to write Some ideas:
I think I lean towards using a new preprocessor. That has less moving parts at runtime and we could encapsulate the full logic into this preprocessor. |
I agree that leveraging our current systems for consistency and efficiency is a smart approach. Imagine it like this: while it's processing, the preprocessor would sneak these strings onto the pages. Maybe it could put them inside a hidden <div style="display: none" id="speaker-notes-strings">
<span id="speaker-notes-title">Speaker Notes</span>
<!-- We can pop more strings in here as needed -->
</div> Then, we just tweak our speaker-notes.js a bit. It would grab the text it needs right from this hidden let speakerNotesTitle = document.querySelector("#speaker-notes-title").innerText;
h4.append(speakerNotesTitle); One of the cool things about this setup is that when mdbook-xgettext does its thing, it'll pick up these strings and pop them into the PO files. That means they're all set for translation, which is super handy. I like this approach because it keeps everything neat and organized. All the translation stuff is bundled into the preprocessor, so the runtime side stays simpler. Plus, it fits nicely with the translation system we've already got, making it easier to handle down the road. Of course, this means a bit of extra work. We'd need to change up the speaker-notes.js and build the new preprocessor from scratch. It might be worth running this idea by rest of the team and other contributors to see what they think and figure out the best way to move forward. |
I too am learning rust using comprehensive-rust btw :- ) |
What I can suggest, we can add an item menu like at the end of the sidebar menu and make it hidden with { |
That would be cool, but unfortuantely
Yes, I think this could work very well! I like the approach too since it has some good qualities:
So the new preprocessor will inject both the hidden You should take a look at @djmitche's tiny mdbook-course preprocessor as a starting point. It adds a bit of information to the pages right now and I think you'll want to copy this approach. |
Sure. I'm on it! : ) |
The "Speaker Notes" string is currently hard-coded in the JavaScript code that injects it:
comprehensive-rust/theme/speaker-notes.js
Line 100 in e9c61b9
There are several other strings in that file that need translation too.
The text was updated successfully, but these errors were encountered: