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
Copy file name to clipboardExpand all lines: docs/01-Writing-Docs.md
+21-32Lines changed: 21 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,45 +1,34 @@
1
-
This document outlines how documentation is handled in Phoenix.
1
+
This document explains the process for managing documentation in Phoenix Code.
2
2
3
3
## The `docs` folder
4
-
The `docs` folder in Phoenix repo is the main code/API/Extension
5
-
docs folder for Phoenix. Most of the Phoenix GitHub Wiki is
6
-
autogenerated from the contents of this folder.
4
+
The docs folder in the Phoenix repository contains guidelines for writing docs and adding translations. Most of the GitHub Wiki is autogenerated from this folder, covering how to update these aspects in your Phoenix repository.
7
5
8
-
### Docs Folder Structure
9
-
There are two main components to the docs folder:
6
+
> The contents of the `docs` folder are automatically pushed into Github Wiki. Make changes to Markdown files in this folder to update wiki entries.
10
7
11
-
1. The contents of the `docs` folder are automatically pushed into gitHub wiki
12
-
as a subfolder `generatedDocs`. Make changes to Markdown files in this folder
13
-
to update wiki entries.
14
-
2. The docs in the `docs/generatedApiDocs` are autoGenerated API docs from source. These
15
-
`markdown` docs should never be manually edited as their contents will be reset when autogenerated
16
-
and all manually made changes will be lost.
17
8
18
9
## How To Write API docs
19
10
This section covers how API docs are auto generated and how you can update API docs.
20
11
21
-
To Include any `.js` file containing [JSDoc](https://jsdoc.app/) in Phoenix API docs,
12
+
To include any `.js` file containing [JSDoc](https://jsdoc.app/) in Phoenix Code API docs,
22
13
have this comment in any part of the file:
23
14
```js
24
15
// @INCLUDE_IN_API_DOCS
25
16
```
26
17
27
18
### Writing JSDoc in source
28
19
Let us consider this example source file [src/utils/Metrics.js](https://github.com/phcode-dev/phoenix/blob/main/src/utils/Metrics.js).
29
-
The file is created with [JSDoc](https://jsdoc.app/) compliant source code comments. Make changes to
30
-
the source code comments as required.
20
+
The file is created with [JSDoc](https://jsdoc.app/) compliant source code comments. Make changes to the source code comments as required.
31
21
32
-
When you run `npm run createJSDoc` or `npm run build` the corresponding docs for the js file are automatically generated at [docs/generatedApiDocs/utils/Metrics-API.md](https://github.com/phcode-dev/phoenix/blob/main/docs/generatedApiDocs/utils/Metrics-API.md).
22
+
When you run `npm run createJSDoc` or `npm run build` the corresponding docs for the js file are automatically generated at [docs/API-Reference/utils/Metrics-API.md](https://github.com/phcode-dev/phoenix/blob/main/docs/API-Reference/utils/Metrics.md).
33
23
34
-
The generated docs should be pushed to Phoenix repo if there are any doc changes.
35
-
Once the changes are pushed, the build system will update the docs in all
Copy file name to clipboardExpand all lines: docs/02-Adding-Translations.md
+14-22Lines changed: 14 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
This document outlines how to add support for various local languages in Phoenix.
1
+
This document outlines how to add support for various local languages in Phoenix Code.
2
2
3
-
Phoenix currently supports over 35 languages, primarily through automatic translations using AWS/Google Translate.
3
+
Phoenix Code currently supports over 35 languages, primarily through automatic translations using AWS/Google Translate.
4
4
5
5
## Quick start
6
6
@@ -9,8 +9,8 @@ Phoenix currently supports over 35 languages, primarily through automatic transl
9
9
or
10
10
2. Follow the below section on [Adding a new locale translation](Adding a new locale translation)
11
11
12
-
### I want to correct some translations in my language
13
-
To update translations for your language, such as French.
12
+
### Update translations for a language
13
+
To update translations for your language, let's say French.
14
14
Follow the below steps:
15
15
1. Find out the language code for your language
16
16
from [ISO-Language code](https://www.w3schools.com/tags/ref_language_codes.asp). For French, this is `fr`.
@@ -21,49 +21,41 @@ from [ISO-Language code](https://www.w3schools.com/tags/ref_language_codes.asp).
21
21
This folder contains all the localised strings. Each sub folder corresponds to an [ISO-Language code](https://www.w3schools.com/tags/ref_language_codes.asp).
22
22
23
23
### The `src/nls/root` folder
24
-
A special folder called the `root` folder houses the reference english translations from which all other locale
25
-
translations are derived. The `root` folder has three main files:
24
+
A special folder called the `root` folder houses the reference English translations from which all other locale translations are derived. The `root` folder has three main files:
26
25
1.`strings.js` - The full list of translated text.
27
-
2.`strings-app.js` - The list of language code to localized language name mapping. This will be used in the switch
28
-
language dialogue in debug menu.
26
+
2.`strings-app.js` - The list of language code to localized language name mapping. This will be used in the switch language dialogue in debug menu.
29
27
3.`urls.js` - local specific URLs.
30
28
31
29
### The `src/nls/<locale>` folder
32
30
Each `src/nls/<locale>` folder contains similar files, plus a few additional ones:
33
-
1.`expertTranslations.json` where you can provide expert translations for specific english strings to locale strings.
34
-
This expert translation will be used instead of machine translations if present for a string.
31
+
1.`expertTranslations.json` where you can provide expert translations for specific English strings to locale strings. This expert translation will be used instead of machine translations if present for a string.
35
32
2.`strings.js` - The full list of translated text for the locale.
36
-
3. Apart from the above tow there are 2 autogenerated files that should not be edited: `lastTranslated.json` and
37
-
`lastTranslatedLocale.json`.
33
+
3. Apart from the above two there are 2 autogenerated files that should not be edited: `lastTranslated.json` and `lastTranslatedLocale.json`.
38
34
39
-
## Autogenerated and manual translations
40
-
When any string changes are made to `src/nls/root/strings.js` or any `src/nls/<locale>/strings.js`,
41
-
it will automatically be scanned by GitHub Actions and the corresponding translations will be generated.
42
-
A pull request will be raised with the new translations.
35
+
## Autogenerated and Manual translations
36
+
When any string changes are made to `src/nls/root/strings.js` or any `src/nls/<locale>/strings.js`, it will automatically be scanned by GitHub Actions and the corresponding translations will be generated. A pull request will be raised with the new translations.
43
37
44
-
You can also run the translation command locally if you have the AWS/GCP keys with the command. This is
45
-
mostly FYI for phoenix internal devs.
38
+
You can also run the translation command locally if you have the AWS/GCP keys with the command. This is mostly FYI for phoenix internal devs.
46
39
```bash
47
40
npm run _translateStrings
48
41
```
49
42
50
43
### Skipping auto translate
51
44
For some strings we may not want to translate them. For Example, for the keyboard shortcut string key `"KEYBOARD_CTRL": "Ctrl"`
52
-
we don't want it translated to any language. Just add another key appending `_DO_NOT_TRANSLATE` to the key
53
-
to disable automatic translations Eg. `"KEYBOARD_CTRL_DO_NOT_TRANSLATE": "true"` just below the original key.
45
+
we don't want it translated to any language. Just add another key appending `_DO_NOT_TRANSLATE` to the key to disable automatic translations Eg. `"KEYBOARD_CTRL_DO_NOT_TRANSLATE": "true"` just below the original key.
54
46
55
47
### Adding expert/manual translation overrides
56
48
We may want to add locale specific expert translation if the autogenerated translation is not good.
57
49
For Eg. consider the key `"LIVE_DEV_LOADING_ERROR_MESSAGE": "Unable to load Live Preview page."`, and specify a manual translation in ro (Romanian). We can add a mapping in the file `nls/ro/expertTranslations.json` with
58
50
the following string `"Unable to load Live Preview page.": "Imposibil de a încărca pagina Live Development"` .
59
51
60
-
When the translation jobs run the next time, the expert translation will be used instead of auto generated translation.
52
+
When the translation jobs run the next time, the expert translation override the auto generated translation.
61
53
62
54
## Adding a new locale translation
63
55
Say we want to add a new language translation `ko`. We have to do the following
64
56
1. In file `nls/strings.js` add the line `"ko": true,`
65
57
2. In file `nls/root/strings-app.js` add the line `"LOCALE_KO": "한국어",` where `한국어` is `Korean` in Korean language.
66
-
3. Create a new folder `nls/ko`
58
+
3. Create a new folder `nls/ko`.
67
59
4. Create a new file `nls/ko/strings.js` with the content `define({});`
68
60
5. Create three new files `nls/ko/lastTranslated.json`, `nls/ko/lastTranslatedLocale.json` and
69
61
`nls/ko/expertTranslations.json` with the content `{}`
0 commit comments