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: contributor_docs/translations.md
+22-18Lines changed: 22 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -11,32 +11,25 @@ In order to simplify the translations process the following rules of thumb were
11
11
12
12
* There is only one file to translate all the texts in any specific language, which is located under the directory, in the respective locale [subdirectory](https://github.com/processing/p5.js-web-editor/tree/develop/translations/locales)
13
13
* The new language code must be added to [client/i18n.js](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/i18n.js#L22)
14
-
* New languages will need to be selected using a dropdown in the Nav component, specifically in function [renderLanguageMenu.](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/components/Nav.jsx#L599)
15
14
* Need to add `TRANSLATIONS_ENABLED=true` to `.env` to activate the dropdown for the languages.
16
15
17
-
#### Nav.js
18
-
Need to add the following code to add a new language as a dropdown menu.
19
-
```js
20
-
<li className="nav__dropdown-item">
21
-
<button
22
-
onFocus={this.handleFocusForLang}
23
-
onBlur={this.handleBlur}
24
-
value="newLanguageValue"
25
-
onClick={e=>this.handleLangSelection(e)}
26
-
>
27
-
newlanguage name in the newlanguage ex: 日本語 (Japanese)
28
-
</button>
29
-
</li>
30
-
```
16
+
#### Language codes
17
+
We use standard [IETF language codes](https://en.wikipedia.org/wiki/IETF_language_tag) to identify languages. In most cases, the code is either two lowercase letters representing a language (`ja` for Japanese) or a language code followed by a hyphen and two uppercase letters for a country (`en-US` for American English).
31
18
32
19
#### i18n.js
33
-
In terms of `i18n.js`, you will need to update 2 things. One is to import a new language from `date-fns/locale`. The other is to add a new language to `languageMap`.
20
+
In terms of `i18n.js`, you will need to update 4 things:
34
21
22
+
1. Add the code for your language to the array of `availableLanguages`.
0 commit comments