[WIP] Multilingual support prototype - #1191
Draft
bact wants to merge 3 commits into
Draft
Conversation
Add internationalisation (i18n) support: - Use mkdocs-static-i18n plugin for MkDocs - Use "folder" structure (one folder for one language) Currently does not work with mike (versions) yet. Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Since JSON context may not be available yet at https://spdx.org/ at the time of model development, this PR will tell JSON Schema generator to use the JSON context URL at https://spdx.github.io/spdx-spec/ instead. For released versions, the URL will be switched to the https://spdx.org/ one. Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Collaborator
Author
|
Alternatively, Materials theme for MkDocs supports multilingual site out-of-the-box. We can use that as well. See: https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/ |
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
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.
This is what we can have now for internationalisation (i18n) support of the spec website, using
mkdocs-static-i18nplugin withMkDocs, see the demo site:For content without translation, it will fallback to English one.
Note that there is no language selector yet. To switches between languages, one needs to add the language code to the URL manually:
(Japanese is chosen for testing purpose because we have some test content in both spdx-spec and spdx-3-model sides)
The demo content is from spdx-spec and spdx-3-model repos combined, based on these PRs/issues:
Configuration
The configuration in
mkdocs.ymlusesfolderstructure option ofmkdocs-static-i18n(seei18nsection in the config file).See the documentation here: https://ultrabug.github.io/mkdocs-static-i18n/setup/
Unresolved issues
As I still have issues having
mikeworking with the i18n plugin, the multiple version builds (3.0.1, 3.1-dev, etc) is not ready.When mike is trying to copy "version-select.css" file from a translated site, it will find that the file is already existed (from the English website), and it will stop with this error message:
Update: a small hack made possible to build mike with i18n now, but I'm not sure if it's a right way to do it. An issue is filed here: jimporter/mike#240