You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A good error message tells the user what to do next. Any ambiguity in errors thrown by Playground public APIs will prompt the developers to open issues.
9
+
A good error message informs the user of the following steps to take. Any ambiguity in errors thrown by Playground public APIs will prompt the developers to open issues.
10
10
11
11
Consider a network error, for example—can we infer the type of error and display a relevant message summarizing the next steps?
12
12
13
13
-**Network error**: "Your internet connection twitched. Try to reload the page.
14
14
-**404**: "Could not find the file".
15
15
-**403**: "The server blocked access to the file".
16
-
-**CORS**: clarify it's a browser security feature and add a link to a detailed explanation (on MDN or another reliable source). Suggest the user move their file somewhere else, like raw.githubusercontent.com, and link to a resource explaining how to set up CORS headers on their servers.
16
+
-**CORS**: clarify it's a browser security feature and add a link to a detailed explanation (on MDN or another reliable source). Suggest the user move their file somewhere else, like `raw.githubusercontent.com`, and link to a resource explaining how to set up CORS headers on their servers.
17
17
18
18
We handle code formatting and linting automatically. Relax, type away, and let the machines do the work.
19
19
@@ -23,7 +23,7 @@ Playground aims to keep the narrowest possible API scope.
23
23
24
24
Public APIs are easy to add and hard to remove. It only takes one PR to introduce a new API, but it may take a thousand to remove it, especially if other projects have already consumed it.
25
25
26
-
- Don't expose unnecessary function, class, constant, or other components.
26
+
- Don't expose unnecessary functions, classes, constants, or other components.
Copy file name to clipboardExpand all lines: packages/docs/site/docs/main/contributing/index.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ id: introduction
6
6
7
7
# Contributing to WP Playground project
8
8
9
-
WordPress Playground is an open-source project that welcomes all contributors—from code to design, documentation to triage.
9
+
WordPress Playground is an open-source project that welcomes contributors of all kinds, from code to design, documentation to triage.
10
10
11
11
## How can I contribute?
12
12
@@ -34,13 +34,13 @@ Want to help sort through open issues and resolve potential bugs? Here's how:
34
34
35
35
WordPress Playground and the WordPress project are strongly rooted in free and open source software. Specifically, WordPress Playground is licenced under GPLv2 (or later) from the [Free Software Foundation](https://www.fsf.org/). You can [read the text of the license here](https://github.com/WordPress/wordpress-playground/blob/trunk/LICENSE) and if that feels overwhelming, WordPress.org has a [friendly GPL Primer](https://make.wordpress.org/community/handbook/wordcamp-organizer/planning-details/gpl-primer/).
36
36
37
-
As such, please be aware of the implications your contributions will fall under:
37
+
As such, please be aware of the implications that your contributions will fall under:
38
38
39
39
- When you contribute, you agree to license your contributions under the GPLv2 (or later) license
40
40
- The GPL license has strong copyleft provisions that ensure all derivative works remain open-source and under the same license terms, thereby promoting a collaborative development environment.
41
41
- The GPL license encourages contributing any changes, bug fixes, or new features back to the original codebase.
42
42
- The GPL license ensures that the project remains free and open-source, not only in terms of cost but also with respect to the freedom to use, modify, and distribute the software.
43
43
44
-
If you have any questions about how the above might effect your contributions, please feel free to reach out on WP Slack and the [`meta-playground` channel](https://wordpress.slack.com/archives/C04EWKGDJ0K).
44
+
If you have any questions about how the above might affect your contributions, please feel free to reach out on WP Slack and the [`meta-playground` channel](https://wordpress.slack.com/archives/C04EWKGDJ0K).
Copy file name to clipboardExpand all lines: packages/docs/site/docs/main/contributing/translations.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,22 +48,22 @@ For example for `es` (Spanish) there's a `packages/docs/site/i18n/es` folder
48
48
Under each language folder there should be a `docusaurus-plugin-content-docs/current` folder.
49
49
For example for `es` (Spanish) there's a `packages/docs/site/i18n/es/docusaurus-plugin-content-docs/current` folder.
50
50
51
-
Under `docusaurus-plugin-content-docs/current` the same structure of files of the original docs (same structure of files than under `packages/docs/site/docs`) should be replicated.
51
+
Under `docusaurus-plugin-content-docs/current`, the same structure of files of the original docs (same structure of files as) under `packages/docs/site/docs`) should be replicated.
52
52
53
-
For example for `es` (Spanish) the following translated files exists: `packages/docs/site/i18n/es/docusaurus-plugin-content-docs/current/main/intro.md`
53
+
For example, for `es` (Spanish), the following translated files exist: `packages/docs/site/i18n/es/docusaurus-plugin-content-docs/current/main/intro.md`
54
54
55
-
If a file is not available under a language's folder the original file in the default language will be loaded
55
+
If a file is not available under a language's folder, the original file in the default language will be loaded
56
56
57
57
When a new language is added (see PR [#1807](https://github.com/WordPress/wordpress-playground/pull/1807)) you can run `npm run write-translations -- --locale <%LANGUAGE%>` from `packages/docs/site` to generate the JSON files with messages that can be translated to a specific language.
58
58
59
-
With the proper i18n `docusaurus.config.js` configuration and files under `i18n` when running `npm run build:docs` from the root of the project specific folders under `dist` for each language will be created.
59
+
With the proper i18n `docusaurus.config.js` configuration and files under `i18n` when running `npm run build:docs` from the root of the project, specific folders under `dist` for each language will be created.
60
60
61
61
## How to locally test a language
62
62
63
63
To locally test an existing language you can do:
64
64
65
65
- Modify (translate) any file under one of the available languages: `packages/docs/site/i18n/{%LANGUAGE%}/docusaurus-plugin-content-docs/current`
66
-
- From `/packages/docs/site` run the version for the language you'd like to test. For example to test `es`:
66
+
- From `/packages/docs/site` run the version for the language you'd like to test. For example, to test `es`:
67
67
68
68
```
69
69
@@ -73,7 +73,7 @@ npm run dev -- --locale es
73
73
74
74
## Language Switcher - UI element to change language
75
75
76
-
The "Language Switcher" is a UI element provided by docusaurus (the docs engine behind Playground Docs) that allows user to change the language of a specific page.
76
+
The "Language Switcher" is a UI element provided by Docusaurus (the docs engine behind Playground Docs) that allows users to change the language of a specific page.
77
77
78
78
To give more visibility to a translated version the language switcher can be displayed by adding the following lines at `docusaurus.config.js`
79
79
@@ -88,17 +88,17 @@ To give more visibility to a translated version the language switcher can be dis
88
88
89
89
This will generate a dropdown in the header to access directly to a language version of each file.
90
90
91
-
It's strongly recommended that a specific language is activated in this Dropdown only when there's a fair amount of pages translated. If it's activated with few pages translated the experience the userwill get is that whenever they change to the language no page will be translated to that language.
91
+
It's strongly recommended that a specific language is activated in this Dropdown only when there's a fair amount of pages translated. If it's activated with a few pages translated, the user's experience will be that whenever they switch to the language, no page will be translated into that language.
92
92
93
93
### Making a language publicly available on the Language Switcher
94
94
95
-
All languages are available when the i18n setup for a language is done and the correct structure of files is available under `i18n`.
95
+
All languages are available once the i18n setup for a language is complete and the correct file structure is in place under `i18n`.
These language versions of the docs should be hidden on the language switcher hidden until there's a fair amount of pages translated for that language. To be more precise, the recommendation is to only make a language publicly available on the Language Switcher when at least the [Documentation](https://wordpress.github.io/wordpress-playground/) section is completely translated for a specific language including the following sections:
101
+
These language versions of the docs should be hidden on the language switcher hidden until there's a fair amount of pages translated for that language. To be more precise, the recommendation is to only make a language publicly available on the Language Switcher when at least the [Documentation](https://wordpress.github.io/wordpress-playground/) section is completely translated for a specific language, including the following sections:
-[Playground web instance](https://wordpress.github.io/wordpress-playground/web-instance)
@@ -109,7 +109,7 @@ These language versions of the docs should be hidden on the language switcher hi
109
109
110
110
Even if the language switcher doesn't display a specific language, work on adding translated pages can still progress, as the translated pages will become publicly available once the PRs containing the translated files are merged.
111
111
112
-
Assuming 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, the `docusaurus.config.js` should look like this in that branch so `npm run build:docs` properly generate the `fr` subsite and only displays the french language in the `localeDropdown` language switcher
112
+
Assuming 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, the `docusaurus.config.js` should look like this in that branch so `npm run build:docs` properly generate the `fr` subsite and only displays the french language in the `localeDropdown` language switcher.
113
113
114
114
```
115
115
{
@@ -140,9 +140,9 @@ Assuming the `fr` language is the first language with the Documentation hub page
140
140
141
141
### Testing the Language Switcher locally
142
142
143
-
Regarding 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.
143
+
Regarding testing the `localeDropdown` locally, I have found that although it 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.
144
144
145
-
You can test the `localeDropdown` from any fork and doing from the root of the project:
145
+
You can test the `localeDropdown` from any fork and do so from the root of the project:
So, a possible approach to testing the `localeDropdown` feature is by deploying it to the GitHub Pages of a forked repository.
161
161
162
-
## Process to translate one page in a language
162
+
## Process to translate one page into a language
163
163
164
164
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`
165
165
166
166
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.
167
167
168
-
When the PR is merged the translated version of that page should appear under https://wordpress.github.io/wordpress-playground/{%LANGUAGE%}
168
+
When the PR is merged, the translated version of that page should appear under https://wordpress.github.io/wordpress-playground/{%LANGUAGE%}
A good error message tells the user what to do next. Any ambiguity in errors thrown by Playground public APIs will prompt the developers to open issues.
11
+
-->
12
+
13
+
# Princípios de codificação
14
+
15
+
## Mensagens de erro
16
+
17
+
Uma boa mensagem de erro informa ao usuário o que fazer a seguir. Qualquer ambiguidade nos erros lançados pelas APIs públicas do Playground levará os desenvolvedores a abrir issues.
18
+
19
+
<!--
20
+
Consider a network error, for example—can we infer the type of error and display a relevant message summarizing the next steps?
21
+
22
+
- **Network error**: "Your internet connection twitched. Try to reload the page.
23
+
- **404**: "Could not find the file".
24
+
- **403**: "The server blocked access to the file".
25
+
- **CORS**: clarify it's a browser security feature and add a link to a detailed explanation (on MDN or another reliable source). Suggest the user move their file somewhere else, like raw.githubusercontent.com, and link to a resource explaining how to set up CORS headers on their servers.
26
+
-->
27
+
28
+
Considere um erro de rede, por exemplo: podemos inferir o tipo de erro e exibir uma mensagem relevante resumindo os próximos passos?
29
+
30
+
-**Erro de rede**: "Sua conexão com a internet oscilou. Tente recarregar a página."
31
+
-**404**: "Não foi possível encontrar o arquivo".
32
+
-**403**: "O servidor bloqueou o acesso ao arquivo".
33
+
-**CORS**: esclareça que é um recurso de segurança do navegador e adicione um link para uma explicação detalhada (no MDN ou outra fonte confiável). Sugira que o usuário mova o arquivo para outro lugar, como raw.githubusercontent.com, e crie um link para um recurso que explique como configurar os cabeçalhos CORS em seus servidores.
34
+
35
+
<!--
36
+
We handle code formatting and linting automatically. Relax, type away, and let the machines do the work.
37
+
-->
38
+
39
+
Lidamos com a formatação e o linting do código automaticamente. Relaxe, digite e deixe as máquinas fazerem o trabalho.
40
+
41
+
<!--
42
+
## Public API
43
+
44
+
Playground aims to keep the narrowest possible API scope.
45
+
-->
46
+
47
+
## API Pública
48
+
49
+
O Playground visa manter o escopo de API o mais restrito possível.
50
+
51
+
<!--
52
+
Public APIs are easy to add and hard to remove. It only takes one PR to introduce a new API, but it may take a thousand to remove it, especially if other projects have already consumed it.
53
+
54
+
- Don't expose unnecessary functions, classes, constants, or other components.
55
+
-->
56
+
57
+
APIs públicas são fáceis de adicionar e difíceis de remover. Leva apenas um PR para introduzir uma nova API, mas pode levar mil para removê-la, especialmente se outros projetos já a consumiram.
58
+
59
+
- Não exponha funções, classes, constantes ou outros componentes desnecessários.
60
+
61
+
<!--
62
+
## Blueprints
63
+
64
+
Blueprints are the primary way to interact with Playground. These JSON files describe a set of steps that Playground executes in order.
65
+
-->
66
+
67
+
## Blueprints
68
+
69
+
Blueprints são a principal forma de interagir com o Playground. Estes arquivos JSON descrevem um conjunto de passos que o Playground executa em ordem.
70
+
71
+
<!--
72
+
### Guidelines
73
+
74
+
Blueprint steps should be **concise and focused**. They should do one thing and do it well.
75
+
76
+
- If you need to create a new step, try refactoring an existing one first.
77
+
- If that's not enough, ensure the new step delivers a new capability. Don't replicate the functionality of existing steps.
78
+
- Assume the step would be called more than once.
79
+
- Assume it would run in a specific order.
80
+
- Add unit tests to verify that.
81
+
-->
82
+
83
+
### Diretrizes
84
+
85
+
Os passos do Blueprint devem ser **concisos e focados**. Eles devem fazer uma coisa e fazê-la bem.
86
+
87
+
- Se você precisar criar um novo passo, tente refatorar um existente primeiro.
88
+
- Se isso não for suficiente, garanta que o novo passo entregue uma nova capacidade. Não replique a funcionalidade de passos existentes.
89
+
- Assuma que o passo será chamado mais de uma vez.
90
+
- Assuma que ele será executado em uma ordem específica.
91
+
- Adicione testes unitários para verificar isso.
92
+
93
+
<!--
94
+
Blueprints should be **intuitive and straightforward**.
95
+
96
+
- Don't require arguments that can be optional.
97
+
- Use plain argument. For example, `slug` instead of `path`.
98
+
- Define constants in virtual JSON files—don't modify PHP files.
99
+
- Define a TypeScript type for the Blueprint. That's how Playground generates its JSON schema.
100
+
- Write a function to handle a Blueprint step. Accept the argument of the type you defined.
101
+
- Provide a usage example in the doc string. It's automatically reflected in the docs.
102
+
-->
103
+
104
+
Blueprints devem ser **intuitivos e diretos**.
105
+
106
+
- Não exija argumentos que podem ser opcionais.
107
+
- Use argumentos simples. Por exemplo, `slug` em vez de `path`.
108
+
- Defina constantes em arquivos JSON virtuais — não modifique arquivos PHP.
109
+
- Defina um tipo TypeScript para o Blueprint. É assim que o Playground gera seu esquema JSON.
110
+
- Escreva uma função para lidar com um passo do Blueprint. Aceite o argumento do tipo que você definiu.
111
+
- Forneça um exemplo de uso na docstring. Ele é refletido automaticamente na documentação.
0 commit comments