Skip to content
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: better paths for links #1765

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

juanmaguitar
Copy link
Collaborator

@juanmaguitar juanmaguitar commented Sep 14, 2024

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

@juanmaguitar juanmaguitar added the [Type] Documentation Improvements or additions to documentation label Sep 14, 2024
Copy link
Collaborator

@bgrgicak bgrgicak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that the docs build passes and manually checked some of the links.

@juanmaguitar juanmaguitar merged commit ff15723 into WordPress:trunk Sep 18, 2024
5 checks passed
juanmaguitar added a commit that referenced this pull request Sep 20, 2024
## 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:
```
packages/docs/site/i18n/es
```
Under each language folder we should have a
`docusaurus-plugin-content-docs/current` folder.
For example for `es` (Spanish) we have:
```
packages/docs/site/i18n/es/docusaurus-plugin-content-docs/current
```

Under `docusaurus-plugin-content-docs/current` we should replicate the
same structure of files of the original docs (same structure of files
than under `packages/docs/site/docs`)

For example for `es` (Spanish) we have just one file translated:
```
packages/docs/site/i18n/es/docusaurus-plugin-content-docs/current/main/intro.md
```

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)

- Change a file under one of the available languages:
`packages/docs/site/i18n/{%LANGUAGE%}/docusaurus-plugin-content-docs/current`
- From `/packages/docs/site` run the version for the language you'd like
to test. For example to test `es`:
```
npm run dev -- --locale es
```

## 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:
- https://wordpress.github.io/wordpress-playground/
- https://wordpress.github.io/wordpress-playground/es/
- https://wordpress.github.io/wordpress-playground/fr/

### UI element to change language 

To give more visibility to a translated version we can uncomment the
following lines at `docusaurus.config.js`
```
{
  type: 'localeDropdown',
  position: 'right',
},
```

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 at
`packages/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_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Documentation Improvements or additions to documentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants