-
Notifications
You must be signed in to change notification settings - Fork 231
Feature/google translate integration #2097
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
base: main
Are you sure you want to change the base?
Conversation
|
Preview is available here: |
ElliotFriend
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is really promising! Thank you!!! 🎉
I've added a couple notes throughout the PR changes.
Wondering if we might be able to adjust the spacing on these elements to make things a little nicer?
Also, I'm seeing some strange behavior where the button doesn't appear to work in the following scenarios:
- On mobile, the button in the "hamburger menu" doesn't seem to do anything
- If the translation button is clicked and then "dismissed" (either closed outright, or if you navigate to some page without selecting a language), the button won't do anything if it's clicked again (unless you refresh the page)
Some of these comments may just be "it's weird" kinds of things that we'll have to just live with and/or fix in the future.
docusaurus.config.ts
Outdated
| plugins: [ | ||
| () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd love if we could have this as a defined plugin in its own file. i'm thinking similar to how we have this route-export-plugin defined
| /* Fix for Google Translate making headers invisible */ | ||
| html.translated-ltr .hash-link, | ||
| html.translated-rtl .hash-link { | ||
| opacity: 1 !important; | ||
| visibility: visible !important; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…eaders - Remove unnecessary scripts (buttons.github.io, fontawesome) - Extract google-translate-init plugin to src/google-translate-plugin.js - Move navbar HTML to GOOGLE_TRANSLATE_ELEMENT constant in config/constants.ts - Fix invisible headers by marking hash-links with notranslate class - Add MutationObserver for SPA navigation support - Update CSS with visibility fallback rules
|
Thank you for the detailed review feedback @ElliotFriend! I've addressed all the points you raised: Changes made:
Regarding the spacing adjustments: the "Select Language" dropdown and "Powered by Google Translate" text are injected by Google Translate itself. I could hide the "Powered by Google" text via CSS for a cleaner look or adjust the spacing/width of the dropdown. Let me know what you'd prefer! |
|
Preview is available here: |
|
Preview is available here: |
…oogle-translate-integration
|
Preview is available here: |

This PR adds a Google Translate widget to the navbar, allowing users to translate the documentation into various languages.