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

translating admonitions #293

Merged
merged 1 commit into from
Mar 1, 2024
Merged

translating admonitions #293

merged 1 commit into from
Mar 1, 2024

Conversation

michalfapso
Copy link
Contributor

Thanks a lot for working on this project!

I have a documentation with multiple languages and I was looking for a way to translate admonitions.

I wasn't sure how should I add a test for it, whether to add an admonition into tests/docs_*_two_languages or should I create a separate testing doc?

@ultrabug
Copy link
Owner

Thanks for this amazing work @michalfapso

I'd rather you add tests to a separate tree so that it's strictly related to the feature and easier to cope with

Please rebase

@michalfapso
Copy link
Contributor Author

Sure, now I've pushed a rebased commit with tests included.

@ultrabug
Copy link
Owner

@michalfapso I forgot to ask sorry but could you share a rationale of the problem you're trying to solve with an example as to why it's not possible currently?

@michalfapso
Copy link
Contributor Author

Sure, @ultrabug, I have a documentation in English with quite a lot of admonitions. Then I have auto-translated it to several other languages which would be later manually corrected by a community. I'm using the material theme and your static-i18n plugin for it.

When I have !!! tip in my English documentation it gets rendered as "Tip" (as seen here: https://squidfunk.github.io/mkdocs-material/reference/admonitions/#supported-types). To translate it to another language I can write !!! tip "Conseil" which replaces the admonition title with "Conseil", but I would prefer to have a translation map for each admonition type so that its translated across the whole documentation consistently.

I could have written a separate script just to post process all markdown files and to add the translation of admonition titles directly to them, but I prefer not having those translations hard coded in all markdowns.

I already have some strings translated via nav_translations, so I find it convenient to have the proposed admonition_tranlstations right beside it in the mkdocs.yml.

Here are some related requests:
squidfunk/mkdocs-material#4599
squidfunk/mkdocs-material#749

@ultrabug
Copy link
Owner

Makes sense and I'm honored that the plugin could help people find a solution to a 2018 problem 👍 thanks

Please check my comments

@michalfapso
Copy link
Contributor Author

Thanks for your comments, @ultrabug. I've tried to apply them in a new commit.

Do you prefer having separate commits of these subsequent changes or should I rebase and keep it in a single commit?

@ultrabug
Copy link
Owner

Do you prefer having separate commits of these subsequent changes or should I rebase and keep it in a single commit?

Rebase please, or I'll squash & merge np

@ultrabug
Copy link
Owner

Almost there!

@michalfapso michalfapso force-pushed the main branch 2 times, most recently from cf52ab8 to a0a5a47 Compare February 24, 2024 12:57
@ultrabug
Copy link
Owner

All green, one final review and we should be good to go

@ultrabug ultrabug mentioned this pull request Feb 29, 2024
@ultrabug ultrabug merged commit a2c95bd into ultrabug:main Mar 1, 2024
11 checks passed
@ultrabug
Copy link
Owner

ultrabug commented Mar 1, 2024

Thanks and congratulations again @michalfapso

@michalfapso
Copy link
Contributor Author

Thanks a lot, @ultrabug! It was my pleasure :)

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

Successfully merging this pull request may close these issues.

2 participants