-
Notifications
You must be signed in to change notification settings - Fork 276
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: Playground Docs Translations - i18n (Tracking Issue) #1798
Comments
@juanmaguitar would it make sense to add a new documentation page with all the contributing instructions listed in this issue? |
## Motivation for the change, related issues This PR adds a Translations Contributions page to Playground Docs as per [this comment](#1798 (comment))
Hello, not sure I've done it right but I've added the french translation to the intro file and create the second file in order to continue to add french translation Hope this is the right way, cc: @jennydupuy |
After the merge of #1766 translations to Docs Pages can now be added to Playground Docs.
There are currently three docs-languages-sites available in production:
For
es
andfr
there are only some translations done on the intro page but everything is ready to add more translated pages for these languagesI open this Issue to centralize and track translations efforts and to provide some tips on how to approach translations to docs pages.
See Instructions and tips on contributing to Playground Docs translations
Implementation details
Under
packages/docs/site/i18n/
there's a folder for each language.For example for
es
(Spanish) we have:Under each language folder there should bea
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
How to locally test a language
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
:Language Switcher - 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
I recommend activating this option only when there's a fair amount of pages translated. If it's activated with few pages translated the experience the user will get is that whenever they change to the language no page will be translated to that 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
trunk
the work to translate the Documentation hub (Quick Start Guide, Playground web instance, About Playground, Guides,... ) in a specific language could start in different branch. Once the first language is completed for those pages the branch could be merged with thelocaleDropdown
uncommented, taking into account that thei18n
config should only contain active languages in production.Asumming the
fr
language is the first language with the Documentation hub pages (Quick Start Guide, Playground web instance, About Playground, Guides,... ) completely translated to French, thedocusaurus.config.js
should look like this in that branch sonpm run build:docs
properly generate thefr
subsite and only displays the french language in thelocaleDropdown
language switcherRegarding testing the
localeDropdown
locally, I have found that although is displayed locally it doesn't really work locally as expected as the translated pages are not found. But it seems to work well in production. I have successfully tested from my fork at https://github.com/wordpress-juanmaguitar/wordpress-playground/tree/docs/i18n and doing from the root of the project:This generates three versions of the docs in the GitHub Pages of my forked repo:
https://wordpress-juanmaguitar.github.io/wordpress-playground/
https://wordpress-juanmaguitar.github.io/wordpress-playground/es/
https://wordpress-juanmaguitar.github.io/wordpress-playground/fr/
So, the best way I have found to test the
localeDropdown
feature (so far) in by deploying it to the GitHub Pages of any forked repo.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%}
Creating a
branch
to work on new translated pages and opening PRsTo contribute to the docs adding translated pages you need to be familiar with Git workflows and contributing to WordPress GitHub repositories.
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
repohttps://developer.wordpress.org/block-editor/contributors/code/git-workflow/
Some commands you may use in this contribution workflow.
cc: @adamziel
The text was updated successfully, but these errors were encountered: