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: developer_docs/translations.md
+39-2
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,47 @@ In order to simplify the translations process the following rules of thumb were
10
10
## Technical Part
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 respective locale [subdirectory](https://github.com/processing/p5.js-web-editor/tree/develop/translations/locales)
13
-
* The new language code must be added to [client/i18n.js](https://github.com/processing/p5.js-web-editor/blob/develop/client/i18n.js#L7)
14
-
* New languages will need to be selected using a dropdown in Nav component, specifically in function [renderLanguageMenu.](https://github.com/processing/p5.js-web-editor/blob/develop/client/components/Nav.jsx#L550)
13
+
* The new language code must be added to [client/i18n.js](https://github.com/processing/p5.js-web-editor/blob/develop/client/i18n.js#L8)
14
+
* New languages will need to be selected using a dropdown in Nav component, specifically in function [renderLanguageMenu.](https://github.com/processing/p5.js-web-editor/blob/develop/client/components/Nav.jsx#L611)
15
15
* Need to add `TRANSLATIONS_ENABLED=true` to `.env` to activate dropdown for the languages.
16
16
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
+
```
31
+
32
+
#### 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`.
0 commit comments