Skip to content

Commit d2fa117

Browse files
Merge branch 'dev' into refactor/layer-2-page-to-chakra
2 parents 72a710f + 59ca240 commit d2fa117

File tree

902 files changed

+13774
-24805
lines changed

Some content is hidden

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

902 files changed

+13774
-24805
lines changed

.all-contributorsrc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10127,6 +10127,51 @@
1012710127
"contributions": [
1012810128
"content"
1012910129
]
10130+
},
10131+
{
10132+
"login": "DeUETH",
10133+
"name": "DeUETH",
10134+
"avatar_url": "https://avatars.githubusercontent.com/u/107472460?v=4",
10135+
"profile": "https://github.com/DeUETH",
10136+
"contributions": [
10137+
"content"
10138+
]
10139+
},
10140+
{
10141+
"login": "erin-at-work",
10142+
"name": "erin-at-work",
10143+
"avatar_url": "https://avatars.githubusercontent.com/u/50590950?v=4",
10144+
"profile": "http://www.erinleelikes.com",
10145+
"contributions": [
10146+
"content"
10147+
]
10148+
},
10149+
{
10150+
"login": "AmazingAng",
10151+
"name": "0xAA",
10152+
"avatar_url": "https://avatars.githubusercontent.com/u/14728591?v=4",
10153+
"profile": "https://github.com/AmazingAng",
10154+
"contributions": [
10155+
"content"
10156+
]
10157+
},
10158+
{
10159+
"login": "changwu-tw",
10160+
"name": "changwu",
10161+
"avatar_url": "https://avatars.githubusercontent.com/u/1557364?v=4",
10162+
"profile": "https://changwu.me/",
10163+
"contributions": [
10164+
"content"
10165+
]
10166+
},
10167+
{
10168+
"login": "uniyj",
10169+
"name": "yj",
10170+
"avatar_url": "https://avatars.githubusercontent.com/u/84749041?v=4",
10171+
"profile": "http://uniyj.eth",
10172+
"contributions": [
10173+
"content"
10174+
]
1013010175
}
1013110176
],
1013210177
"contributorsPerLine": 7,

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ALGOLIA_ADMIN_KEY=insertValue
66
ETHERSCAN_API_KEY=insertValue
77
GATSBY_ALGOLIA_APP_ID=insertValue
88
GATSBY_ALGOLIA_SEARCH_KEY=insertValue
9+
GATSBY_ALGOLIA_BASE_SEARCH_INDEX_NAME=insertValue
910
GATSBY_GITHUB_TOKEN_READ_ONLY=insertValue
1011
GATSBY_FUNCTIONS_PATH=insertValue
1112

.github/labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@
2929
- src/pages/*
3030
- src/pages-conditional/*
3131
- src/content/**/*
32+
33+
"event :date:":
34+
- src/data/community-events.json

.github/workflows/chromatic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ jobs:
3838
uses: chromaui/action@v1
3939
# Options required for Chromatic's GitHub Action
4040
with:
41-
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
41+
projectToken: fee8e66c9916
4242
# 👇 Only fail if Storybook contains stories that error
4343
exitZeroOnChanges: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ 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
80+
i18n/merged
7981
# Auto generated code when gatsby build the site
8082
src/gatsby-types.d.ts
8183

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
15841584
<td align="center" valign="top" width="14.28%"><a href="https://jarrodwatts.com"><img src="https://avatars.githubusercontent.com/u/35651410?v=4?s=100" width="100px;" alt="Jarrod Watts"/><br /><sub><b>Jarrod Watts</b></sub></a><br /><a href="#content-jarrodwatts" title="Content">🖋</a></td>
15851585
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mlCode111"><img src="https://avatars.githubusercontent.com/u/34754144?v=4?s=100" width="100px;" alt="Miao"/><br /><sub><b>Miao</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=mlCode111" title="Code">💻</a></td>
15861586
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ljiatu"><img src="https://avatars.githubusercontent.com/u/3280973?v=4?s=100" width="100px;" alt="Jiatu Liu"/><br /><sub><b>Jiatu Liu</b></sub></a><br /><a href="#content-ljiatu" title="Content">🖋</a></td>
1587+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/DeUETH"><img src="https://avatars.githubusercontent.com/u/107472460?v=4?s=100" width="100px;" alt="DeUETH"/><br /><sub><b>DeUETH</b></sub></a><br /><a href="#content-DeUETH" title="Content">🖋</a></td>
1588+
<td align="center" valign="top" width="14.28%"><a href="http://www.erinleelikes.com"><img src="https://avatars.githubusercontent.com/u/50590950?v=4?s=100" width="100px;" alt="erin-at-work"/><br /><sub><b>erin-at-work</b></sub></a><br /><a href="#content-erin-at-work" title="Content">🖋</a></td>
1589+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AmazingAng"><img src="https://avatars.githubusercontent.com/u/14728591?v=4?s=100" width="100px;" alt="0xAA"/><br /><sub><b>0xAA</b></sub></a><br /><a href="#content-AmazingAng" title="Content">🖋</a></td>
1590+
</tr>
1591+
<tr>
1592+
<td align="center" valign="top" width="14.28%"><a href="https://changwu.me/"><img src="https://avatars.githubusercontent.com/u/1557364?v=4?s=100" width="100px;" alt="changwu"/><br /><sub><b>changwu</b></sub></a><br /><a href="#content-changwu-tw" title="Content">🖋</a></td>
1593+
<td align="center" valign="top" width="14.28%"><a href="http://uniyj.eth"><img src="https://avatars.githubusercontent.com/u/84749041?v=4?s=100" width="100px;" alt="yj"/><br /><sub><b>yj</b></sub></a><br /><a href="#content-uniyj" title="Content">🖋</a></td>
15871594
</tr>
15881595
</tbody>
15891596
</table>

docs/locales-process.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Locales generation process
2+
3+
Every time `yarn build` or `yarn start` is executed, the following process is
4+
going to be triggered as well:
5+
6+
<img src="./locales.png">
7+
8+
With this process, we reduce the amount of text we bundle on each page since we
9+
are querying only the necessary translations that each page needs.

docs/locales.png

61.5 KB
Loading

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: 53 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`,
@@ -266,6 +248,59 @@ const config: GatsbyConfig = {
266248
generateMatchPathRewrites: false,
267249
},
268250
},
251+
// i18n support
252+
{
253+
resolve: `gatsby-source-filesystem`,
254+
options: {
255+
path: path.resolve(`./i18n/locales`),
256+
name: `locale`,
257+
},
258+
},
259+
// Wraps the entire page with a custom layout component
260+
// Note: keep this before the i18n plugin declaration in order to have the
261+
// i18n provider wrapping the layout component
262+
{
263+
resolve: `gatsby-plugin-layout`,
264+
options: {
265+
component: path.resolve(`./src/components/Layout`),
266+
},
267+
},
268+
{
269+
resolve: `gatsby-plugin-react-i18next`,
270+
options: {
271+
localeJsonSourceName: `locale`, // name given to `gatsby-source-filesystem` plugin.
272+
languages: supportedLanguages,
273+
defaultLanguage,
274+
generateDefaultLanguagePage: true,
275+
redirect: false,
276+
siteUrl,
277+
trailingSlash: "always",
278+
// i18next options
279+
i18nextOptions: {
280+
fallbackLng: defaultLanguage,
281+
interpolation: {
282+
escapeValue: false,
283+
},
284+
load: "currentOnly",
285+
lowerCaseLng: true,
286+
cleanCode: true,
287+
react: {
288+
transSupportBasicHtmlNodes: true,
289+
transKeepBasicHtmlNodesFor: [
290+
"br",
291+
"strong",
292+
"i",
293+
"bold",
294+
"b",
295+
"em",
296+
"sup",
297+
],
298+
},
299+
keySeparator: false,
300+
nsSeparator: false,
301+
},
302+
},
303+
},
269304
],
270305
// https://www.gatsbyjs.com/docs/reference/release-notes/v2.28/#feature-flags-in-gatsby-configjs
271306
flags: {

0 commit comments

Comments
 (0)