Skip to content

Commit 7255794

Browse files
authored
Merge branch 'dev' into feat/convert-Tooltip-component-to-ChakraUI
2 parents 003d53d + d9b29a1 commit 7255794

File tree

222 files changed

+4516
-3961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+4516
-3961
lines changed

.all-contributorsrc

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7313,7 +7313,8 @@
73137313
"avatar_url": "https://avatars.githubusercontent.com/u/70309026?v=4",
73147314
"profile": "https://github.com/LuozhuZhang",
73157315
"contributions": [
7316-
"doc"
7316+
"doc",
7317+
"ideas"
73177318
]
73187319
},
73197320
{
@@ -9635,6 +9636,78 @@
96359636
"contributions": [
96369637
"doc"
96379638
]
9639+
},
9640+
{
9641+
"login": "nocibambi",
9642+
"name": "András Novoszáth",
9643+
"avatar_url": "https://avatars.githubusercontent.com/u/8539674?v=4",
9644+
"profile": "https://www.linkedin.com/in/andrasnovoszath/",
9645+
"contributions": [
9646+
"doc"
9647+
]
9648+
},
9649+
{
9650+
"login": "SahilAujla",
9651+
"name": "Sahil Aujla",
9652+
"avatar_url": "https://avatars.githubusercontent.com/u/83442423?v=4",
9653+
"profile": "http://sahilaujla.com",
9654+
"contributions": [
9655+
"doc"
9656+
]
9657+
},
9658+
{
9659+
"login": "ritave",
9660+
"name": "Olaf Tomalka",
9661+
"avatar_url": "https://avatars.githubusercontent.com/u/1614945?v=4",
9662+
"profile": "https://github.com/ritave",
9663+
"contributions": [
9664+
"doc"
9665+
]
9666+
},
9667+
{
9668+
"login": "armgp",
9669+
"name": "Abhiram G P",
9670+
"avatar_url": "https://avatars.githubusercontent.com/u/49094298?v=4",
9671+
"profile": "https://github.com/armgp",
9672+
"contributions": [
9673+
"code"
9674+
]
9675+
},
9676+
{
9677+
"login": "aelmanaa",
9678+
"name": "Amine E.",
9679+
"avatar_url": "https://avatars.githubusercontent.com/u/4503543?v=4",
9680+
"profile": "https://github.com/aelmanaa",
9681+
"contributions": [
9682+
"doc"
9683+
]
9684+
},
9685+
{
9686+
"login": "Roshan-R",
9687+
"name": "Roshan R Chandar",
9688+
"avatar_url": "https://avatars.githubusercontent.com/u/43182697?v=4",
9689+
"profile": "https://roshan.ml/",
9690+
"contributions": [
9691+
"doc"
9692+
]
9693+
},
9694+
{
9695+
"login": "mossow",
9696+
"name": "mossow",
9697+
"avatar_url": "https://avatars.githubusercontent.com/u/9072132?v=4",
9698+
"profile": "https://github.com/mossow",
9699+
"contributions": [
9700+
"doc"
9701+
]
9702+
},
9703+
{
9704+
"login": "OpenWJY",
9705+
"name": "yujingwei",
9706+
"avatar_url": "https://avatars.githubusercontent.com/u/29328336?v=4",
9707+
"profile": "https://github.com/OpenWJY",
9708+
"contributions": [
9709+
"doc"
9710+
]
96389711
}
96399712
],
96409713
"contributorsPerLine": 7,

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ yarn-error.log
7676
src/data/contributors.json
7777
# These files are generated by `yarn merge-translations` command
7878
src/intl/*.json
79+
i18n/locales
7980
# Auto generated code when gatsby build the site
8081
src/gatsby-types.d.ts
8182

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
11901190
<td align="center"><a href="https://github.com/1337-ishaan"><img src="https://avatars.githubusercontent.com/u/64636222?v=4?s=100" width="100px;" alt="Ishaan Parmar"/><br /><sub><b>Ishaan Parmar</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=1337-ishaan" title="Code">💻</a> <a href="#design-1337-ishaan" title="Design">🎨</a> <a href="#ideas-1337-ishaan" title="Ideas, Planning, & Feedback">🤔</a></td>
11911191
<td align="center"><a href="http://tarunbatra.com"><img src="https://avatars.githubusercontent.com/u/5329230?v=4?s=100" width="100px;" alt="Tarun Batra"/><br /><sub><b>Tarun Batra</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=tarunbatra" title="Documentation">📖</a> <a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3Atarunbatra" title="Bug reports">🐛</a></td>
11921192
<td align="center"><a href="https://github.com/max-donger"><img src="https://avatars.githubusercontent.com/u/56192627?v=4?s=100" width="100px;" alt="Max"/><br /><sub><b>Max</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=max-donger" title="Documentation">📖</a> <a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3Amax-donger" title="Bug reports">🐛</a></td>
1193-
<td align="center"><a href="https://github.com/LuozhuZhang"><img src="https://avatars.githubusercontent.com/u/70309026?v=4?s=100" width="100px;" alt="Luozhu"/><br /><sub><b>Luozhu</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=LuozhuZhang" title="Documentation">📖</a></td>
1193+
<td align="center"><a href="https://github.com/LuozhuZhang"><img src="https://avatars.githubusercontent.com/u/70309026?v=4?s=100" width="100px;" alt="Luozhu"/><br /><sub><b>Luozhu</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=LuozhuZhang" title="Documentation">📖</a> <a href="#ideas-LuozhuZhang" title="Ideas, Planning, & Feedback">🤔</a></td>
11941194
</tr>
11951195
<tr>
11961196
<td align="center"><a href="http://www.linkedin.com/in/sharma-yash"><img src="https://avatars.githubusercontent.com/u/44340561?v=4?s=100" width="100px;" alt="Yash Sharma "/><br /><sub><b>Yash Sharma </b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=yash-sharma1" title="Documentation">📖</a></td>
@@ -1514,6 +1514,16 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
15141514
<td align="center"><a href="https://github.com/Amit0617"><img src="https://avatars.githubusercontent.com/u/71893015?v=4?s=100" width="100px;" alt="AMIT KUMAR MISHRA"/><br /><sub><b>AMIT KUMAR MISHRA</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=Amit0617" title="Documentation">📖</a></td>
15151515
<td align="center"><a href="https://github.com/Saksham010"><img src="https://avatars.githubusercontent.com/u/56692835?v=4?s=100" width="100px;" alt="Saksham Thapa"/><br /><sub><b>Saksham Thapa</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/issues?q=author%3ASaksham010" title="Bug reports">🐛</a></td>
15161516
<td align="center"><a href="https://github.com/vjgaur"><img src="https://avatars.githubusercontent.com/u/1871257?v=4?s=100" width="100px;" alt="Vijayendra Gaur"/><br /><sub><b>Vijayendra Gaur</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=vjgaur" title="Documentation">📖</a></td>
1517+
<td align="center"><a href="https://www.linkedin.com/in/andrasnovoszath/"><img src="https://avatars.githubusercontent.com/u/8539674?v=4?s=100" width="100px;" alt="András Novoszáth"/><br /><sub><b>András Novoszáth</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=nocibambi" title="Documentation">📖</a></td>
1518+
</tr>
1519+
<tr>
1520+
<td align="center"><a href="http://sahilaujla.com"><img src="https://avatars.githubusercontent.com/u/83442423?v=4?s=100" width="100px;" alt="Sahil Aujla"/><br /><sub><b>Sahil Aujla</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=SahilAujla" title="Documentation">📖</a></td>
1521+
<td align="center"><a href="https://github.com/ritave"><img src="https://avatars.githubusercontent.com/u/1614945?v=4?s=100" width="100px;" alt="Olaf Tomalka"/><br /><sub><b>Olaf Tomalka</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=ritave" title="Documentation">📖</a></td>
1522+
<td align="center"><a href="https://github.com/armgp"><img src="https://avatars.githubusercontent.com/u/49094298?v=4?s=100" width="100px;" alt="Abhiram G P"/><br /><sub><b>Abhiram G P</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=armgp" title="Code">💻</a></td>
1523+
<td align="center"><a href="https://github.com/aelmanaa"><img src="https://avatars.githubusercontent.com/u/4503543?v=4?s=100" width="100px;" alt="Amine E."/><br /><sub><b>Amine E.</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=aelmanaa" title="Documentation">📖</a></td>
1524+
<td align="center"><a href="https://roshan.ml/"><img src="https://avatars.githubusercontent.com/u/43182697?v=4?s=100" width="100px;" alt="Roshan R Chandar"/><br /><sub><b>Roshan R Chandar</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=Roshan-R" title="Documentation">📖</a></td>
1525+
<td align="center"><a href="https://github.com/mossow"><img src="https://avatars.githubusercontent.com/u/9072132?v=4?s=100" width="100px;" alt="mossow"/><br /><sub><b>mossow</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=mossow" title="Documentation">📖</a></td>
1526+
<td align="center"><a href="https://github.com/OpenWJY"><img src="https://avatars.githubusercontent.com/u/29328336?v=4?s=100" width="100px;" alt="yujingwei"/><br /><sub><b>yujingwei</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=OpenWJY" title="Documentation">📖</a></td>
15171527
</tr>
15181528
</tbody>
15191529
</table>

docs/best-practices.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Markdown will be translated as whole pages of content, so no specific action is
5252

5353
- _tl;dr Each individual JSON entry should be a complete phrase by itself_
5454

55-
- This is done using the `Translation` component. However there is an alternative method for regular JS: `gatsby-theme-i18n` with `/src/utils/translations.ts`
55+
- This is done using the `Translation` component. However there is an alternative method for regular JS: using the `t` function from `gatsby-plugin-react-i18next`
5656

5757
- **Method one: `<Translation />` component (preferred if only needed in JSX)**
5858

@@ -63,19 +63,18 @@ Markdown will be translated as whole pages of content, so no specific action is
6363
;<Translation id="language-json-key" />
6464
```
6565

66-
- **Method two: `translateMessageId()`**
66+
- **Method two: `t()`**
6767

6868
```tsx
69-
import { useIntl } from "react-intl"
70-
import { translateMessageId } from "src/utils/translations"
69+
import { useTranslation } from "gatsby-plugin-react-i18next"
7170
7271
// Utilize anywhere in JS using
73-
const intl = useIntl()
74-
translateMessageId("language-json-key", intl)
72+
const { t } = useTranslation()
73+
t("language-json-key")
7574
```
7675

7776
```tsx
78-
const siteTitle = translateMessageId("site-title", intl)
77+
const siteTitle = t("site-title")
7978
```
8079

8180
## React Hooks

gatsby-browser.tsx

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
* See: https://www.gatsbyjs.org/docs/browser-apis/
55
*/
66

7-
import React from "react"
8-
import browserLang from "browser-lang"
9-
import { withPrefix, GatsbyBrowser } from "gatsby"
10-
117
import Prism from "prism-react-renderer/prism"
128
;(typeof global !== "undefined" ? global : window).Prism = Prism
139

@@ -16,53 +12,6 @@ import "@formatjs/intl-locale/polyfill"
1612
import "@formatjs/intl-numberformat/polyfill"
1713
import "@formatjs/intl-numberformat/locale-data/en"
1814

19-
import Layout from "./src/components/Layout"
20-
import {
21-
supportedLanguages,
22-
defaultLanguage,
23-
isLang,
24-
} from "./src/utils/languages"
25-
import { IS_DEV } from "./src/utils/env"
26-
import { Context } from "./src/types"
27-
2815
// Default languages included:
2916
// https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js
3017
require("prismjs/components/prism-solidity")
31-
32-
// Prevents <Layout/> from unmounting on page transitions
33-
// https://www.gatsbyjs.com/docs/layout-components/#how-to-prevent-layout-components-from-unmounting
34-
// @ts-ignore: returning `null` is not accepted by the `GatsbyBrowser` type def.
35-
export const wrapPageElement: GatsbyBrowser<
36-
any,
37-
Context
38-
>["wrapPageElement"] = ({ element, props }) => {
39-
const { location, pageContext } = props
40-
const { pathname, search } = location
41-
const { originalPath } = pageContext
42-
43-
const [, pathLocale] = pathname.split("/")
44-
45-
// client side redirect on paths that don't have a locale in them. Most useful
46-
// on dev env where we don't have server redirects
47-
if (IS_DEV && !isLang(pathLocale)) {
48-
let detected =
49-
window.localStorage.getItem("eth-org-language") ||
50-
browserLang({
51-
languages: supportedLanguages,
52-
fallback: defaultLanguage,
53-
})
54-
55-
if (!isLang(detected)) {
56-
detected = defaultLanguage
57-
}
58-
59-
const queryParams = search || ""
60-
const newUrl = withPrefix(`/${detected}${originalPath}${queryParams}`)
61-
window.localStorage.setItem("eth-org-language", detected)
62-
window.location.replace(newUrl)
63-
64-
return null
65-
}
66-
67-
return <Layout {...props}>{element}</Layout>
68-
}

gatsby-config.ts

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@ const config: GatsbyConfig = {
3535
editContentUrl: `https://github.com/ethereum/ethereum-org-website/tree/dev/`,
3636
},
3737
plugins: [
38-
// i18n support
39-
{
40-
resolve: `gatsby-theme-i18n`,
41-
options: {
42-
defaultLang: defaultLanguage,
43-
prefixDefault: true,
44-
locales: supportedLanguages.length
45-
? supportedLanguages.join(" ")
46-
: null,
47-
configPath: path.resolve(`./i18n/config.json`),
48-
},
49-
},
50-
{
51-
resolve: `gatsby-theme-i18n-react-intl`,
52-
options: {
53-
defaultLocale: `./src/intl/en.json`,
54-
},
55-
},
5638
// Web app manifest
5739
{
5840
resolve: `gatsby-plugin-manifest`,
@@ -265,6 +247,56 @@ const config: GatsbyConfig = {
265247
generateMatchPathRewrites: false,
266248
},
267249
},
250+
// i18n support
251+
{
252+
resolve: `gatsby-source-filesystem`,
253+
options: {
254+
path: path.resolve(`./i18n/locales`),
255+
name: `locale`,
256+
},
257+
},
258+
// Wraps the entire page with a custom layout component
259+
// Note: keep this before the i18n plugin declaration in order to have the
260+
// i18n provider wrapping the layout component
261+
{
262+
resolve: `gatsby-plugin-layout`,
263+
options: {
264+
component: path.resolve(`./src/components/Layout`),
265+
},
266+
},
267+
{
268+
resolve: `gatsby-plugin-react-i18next`,
269+
options: {
270+
localeJsonSourceName: `locale`, // name given to `gatsby-source-filesystem` plugin.
271+
languages: supportedLanguages,
272+
defaultLanguage: defaultLanguage,
273+
generateDefaultLanguagePage: true,
274+
redirect: false,
275+
siteUrl,
276+
trailingSlash: "always",
277+
// i18next options
278+
i18nextOptions: {
279+
fallbackLng: defaultLanguage,
280+
interpolation: {
281+
escapeValue: false,
282+
},
283+
react: {
284+
transSupportBasicHtmlNodes: true,
285+
transKeepBasicHtmlNodesFor: [
286+
"br",
287+
"strong",
288+
"i",
289+
"bold",
290+
"b",
291+
"em",
292+
"sup",
293+
],
294+
},
295+
keySeparator: false,
296+
nsSeparator: false,
297+
},
298+
},
299+
},
268300
],
269301
// https://www.gatsbyjs.com/docs/reference/release-notes/v2.28/#feature-flags-in-gatsby-configjs
270302
flags: {

0 commit comments

Comments
 (0)