-
Notifications
You must be signed in to change notification settings - Fork 271
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
Docs: i18n setup #1766
Docs: i18n setup #1766
Conversation
@juanmaguitar I'm unable to start the dev site because of link issues.
|
## Motivation for the change, related issues This PR removes "wordpress-playground" from links as it's not needed, and to keep consistency with the rest of the links. It also unifies links, removing relative paths so they start from root. This change reduces the chance of errors when using these files for other languages (See #1766) This PR also fixes this error when doing `npm run build:docs` ``` Error: Docs markdown link couldn't be resolved: (../developers/23-architecture/18-host-your-own-playground.md) in "/Users/juanmanuelgarrido/PROJECTS/2024/wordpress-playground/packages/docs/site/docs/_fragments/_playground_wp_net_may_stop_working.md" for version current at Array.forEach (<anonymous>) [ERROR] Client bundle compiled with errors therefore further build is impossible. Warning: run-commands command "docusaurus build --out-dir ../../../dist/docs/build" exited with non-zero status code ```
@bgrgicak I just tried it locally and is working for me. See terminal output when doing
|
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.
Thanks @juanmaguitar! Overall it's working, but I wasn't able to get the language switcher to work.
Thanks for testing this @bgrgicak Regarding the visibility of the language switcher I added it to the PR commented because I think this is something that should be activated when there are at least some pages translated of each language. My suggestion here would be to keep this language switcher hidden until there's a fair amount of pages translated. To be more precise, I would suggest this switcher is only enabled for a language when at least the Documentation section is completely translated for a specific language including the following sections:
With the current PR merged in Asumming the
Regarding testing the
This generates three versions of the docs in the GitHub Pages of my forked repo: https://wordpress-juanmaguitar.github.io/wordpress-playground/ So, the best way I have found to test the cc: @adamziel |
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.
Thanks for explaining @juanmaguitar. I'm happy to merge this as is.
Hi @juanmaguitar, could you explain the process to create a branch please? |
It seems like this PR broke the docs build in trunk:
cc @bgrgicak |
In this #1766 (comment), you mention the Changelog section as needing to be translated to activate the language switcher, but it seems to me that this section is not essential for users needing to learn about the Playground. After all, this section contains a lot of technical elements that are difficult for a basic user to understand. In addition, I think it would be a good idea to add to each page a reference to the contributor(s) who wrote the source page, and to the contributor(s) who translated/reviewed it. |
## Motivation for the change, related issues This PR fixes the issue reported at #1766 (comment) ## Implementation details ## Testing Instructions (or ideally a Blueprint) Run `npm run build:docs` from this branch and check how the build is done succesfully
I agree with this @jennydupuy. I have opened #1798 to coordinate translations efforts and provide some instructions and tips on the translations workflows.
This is a great idea. Would you mind opening a specific issue for this?
The process of creating a branch to open new PRs with translated pages on https://github.com/WordPress/wordpress-playground is the same than contributing to other WordPress repositories such as gutenberg. The process explained in the following resource can be applied to contributing to the wordpress-playground repo At #1798 you have more tips and instructions to contribute to Playground Docs translations |
Docusaurus doesn't seem to support it – there's quite a few people requesting that feature: facebook/docusaurus#6218 (comment) I haven't found any plugins either. We'd need to build that one from scratch. Let's track it in a separate issue. |
## Motivation for the change, related issues With the merge of #1766 translations are enabled for Playground Docs. Files can be translated but also web parts. This PR incorporates JSON files with messages to translate for each language. This files have been generated by running from from `packages/docs/site`: ``` npm run write-translations -- --locale fr npm run write-translations -- --locale es ``` These files still need to be translated. This PR just adds them for the sake of simplifying the work of contributors translating Playground Docs for a specific language.
Motivation for the change, related issues
As per #1720 this PR prepares the Playground Docs Site to have the docs available in different languages.
Implementation details
Under
packages/docs/site/i18n/
there should be a folder for each language.For example for
es
(Spanish) we have:Under each language folder we should have a
docusaurus-plugin-content-docs/current
folder.For example for
es
(Spanish) we have:Under
docusaurus-plugin-content-docs/current
we should replicate the same structure of files of the original docs (same structure of files than underpackages/docs/site/docs
)For example for
es
(Spanish) we have just one file translated:If a file is not available under a language's folder the original file in the default language will be loaded
Testing Instructions (or ideally a Blueprint)
packages/docs/site/i18n/{%LANGUAGE%}/docusaurus-plugin-content-docs/current
/packages/docs/site
run the version for the language you'd like to test. For example to testes
:Notes
When this PR is merged (due to the automatic processes to build and deploy on PR merging), there should be the following three versions of the docs in production:
UI element to change language
To give more visibility to a translated version we can uncomment the following lines at
docusaurus.config.js
This will generate a dropdown in the header to access directly to a language version of each file
NOTE: I recommend activating this option only when there's a fair amount of pages translaged
Process to translate one page in a language
The recommended process is to copy and paste the
.md
file from the original path (packages/docs/site/docs
) into the desired language path (packages/docs/site/i18n/{%LANGUAGE%}/docusaurus-plugin-content-docs/current
). It is important to replicate the structure of files atpackages/docs/site/docs
The file under
packages/docs/site/i18n/{%LANGUAGE%}/docusaurus-plugin-content-docs/current
can be translated and a PR can be created with the new changes.When the PR is merged the translated version of that page should appear under https://wordpress.github.io/wordpress-playground/{%LANGUAGE%}
NOTE: Because there's a process of copying and pasting files from
packages/docs/site/docs
to the languages folder, the #1765 PR is recommended to be merged to reduce the number of errors when building the docs