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

How to print i18n pages #70

Open
roddc opened this issue May 18, 2022 · 5 comments
Open

How to print i18n pages #70

roddc opened this issue May 18, 2022 · 5 comments

Comments

@roddc
Copy link

roddc commented May 18, 2022

I am using mkdocs-static-i18n to generate multi-language pages, but mkdocs-print-site-plugin only generates the default language for print-page.

Is there a option I can use to generate other languages?

@timvink
Copy link
Owner

timvink commented May 18, 2022

Not yet. Haven't looked into this.

Something you'd like to pick up?

@sarathorhalls
Copy link

This would also be useful to me, and have interest in implementing it

@timvink
Copy link
Owner

timvink commented Oct 21, 2024

What is the use case exactly?

You could just define an environment value to set the language, and create a loop in bash to build the docs in different languages?

@sarathorhalls
Copy link

I would rather not need to go that route and like the convenience that i18n gives me. Setting that up for the multiple projects I'm documenting. I'm more than willing to work on the feature as I really enjoy your implementation for non translated projects. If you could just point me in the general direction?

@timvink
Copy link
Owner

timvink commented Oct 22, 2024

Ok cool.

So i18n adds links to translated pages to the top of every page.

The way this plugin works is that it 'collects' the pages. And it seems only the main language is picked up.

My approach would be to first inspect the docs/ folder, and see what the file structure is that i18n uses. Probably something with original filename and the language.

Then I would see if you can access the i18n plugin config in the final plugin event of print plugin. I've done this in the table-reader plugin before. Breakpoints are great for this, and you can explore the config yourself.

The idea would be to construct not 1, but multiple collections of files, and create multiple print pages (with the right language suffix). And then we add some links to the HTML print page

The last step would be to hide the i18n links when printing the HTML page (or exporting to PDF). You can do this using CSS, see the other elements where we do the same.

Not easy if this is your first mkdocs plugin contribution.. but feel free to dive in!

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