-
Notifications
You must be signed in to change notification settings - Fork 1
Add language dropdown menu but only for versions 3.13 and later #725
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a conditional statement where only certain versions specified in `docusaurus.config.js` should show language dropdown menu.
The custom field `allowedLanguageDropdownVersions` specifies which versions of docs should show the language dropdown menu. This custom field is based on the conditional statements in `src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js`.
If a version doesn't have Japanese docs, redirect visitors to the English page and URL. Without this fix, visitors would see English content with Japanese UI elements on a link with `ja-jp` in the URL.
Since ScalarDB 3.13 and later will have Japanese versions of docs, the Google Translate widget should still appear at the top of the page for earlier versions.
This commit fixes an issue with the Google Translate widget not reappearing when navigating from a version that has Japanese docs (like 3.13), to a version that doesn't have Japanese docs (like 3.12), then moving back to a version that has Japanese docs, (like 3.13), and then back to a version that doesn't have Japanese docs (like 3.11).
Redirects don't seem to work for docs in the non-primary language.
josh-wong
added a commit
that referenced
this pull request
May 14, 2025
* Enable language dropdown menu * Make specific versions show language dropdown menu Add a conditional statement where only certain versions specified in `docusaurus.config.js` should show language dropdown menu. * Add custom field (`allowedLanguageDropdownVersions`) The custom field `allowedLanguageDropdownVersions` specifies which versions of docs should show the language dropdown menu. This custom field is based on the conditional statements in `src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js`. * Redirect visitors on versions without Japanese docs If a version doesn't have Japanese docs, redirect visitors to the English page and URL. Without this fix, visitors would see English content with Japanese UI elements on a link with `ja-jp` in the URL. * Show Google Translate widget only on 3.4 to 3.12 Since ScalarDB 3.13 and later will have Japanese versions of docs, the Google Translate widget should still appear at the top of the page for earlier versions. * Fix Google Translate widget not reappearing on versions This commit fixes an issue with the Google Translate widget not reappearing when navigating from a version that has Japanese docs (like 3.13), to a version that doesn't have Japanese docs (like 3.12), then moving back to a version that has Japanese docs, (like 3.13), and then back to a version that doesn't have Japanese docs (like 3.11). * Update README.mdx * Create README.mdx * Remove redirect Redirects don't seem to work for docs in the non-primary language.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a language dropdown, but only for versions 3.13 and later.
Docusaurus has a built-in language-switching feature, but it assumes that the docs are in multiple languages across versions. Since our docs in Japanese start from ScalarDB 3.13, we need to show the language dropdown menu for version 3.13 and later.
Note
For now, the Google Translate widget will still exist on versions of docs (3.4 to 3.12) that don't have translations.
Related issues and/or PRs
Changes made
Checklist
Additional notes (optional)
N/A