Skip to content

Commit 3842b48

Browse files
authored
Merge branch 'dev' into bread-crumbs-refactor
2 parents cfcf559 + 5671c0f commit 3842b48

File tree

686 files changed

+35799
-23744
lines changed

Some content is hidden

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

686 files changed

+35799
-23744
lines changed

.all-contributorsrc

Lines changed: 549 additions & 3 deletions
Large diffs are not rendered by default.

.babelrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

.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: 80 additions & 7 deletions
Large diffs are not rendered by default.

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

docs/deploy-and-review-process.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Deploy and review process
2+
3+
This documentation outlines our current processes for how we deploy the latest changes to ethereum.org, and how we prioritize items in our review process.
4+
5+
## Deploy process
6+
7+
Anything merged into the `dev` branch of [ethereum.org](http://ethereum.org) will go live on ethereum.org at the next release. Currently, we deploy the latest changes to [ethereum.org](http://ethereum.org) twice per week (Monday and Thursday). When deploying, we merge the `dev` branch into the `master` branch. The `master` branch is the latest live version of [ethereum.org](https://ethereum.org).
8+
9+
Occasionally, we’ll also do a patch deploy to fix an urgent or widespread issue.
10+
11+
## Review process
12+
13+
### General review process
14+
15+
We use a first-in, first-out system for reviewing pull requests. The longer a pull request has been open, the higher priority it is for our team to review. In some cases—for example, fixing a high-priority issue or merging low-hanging fruit for a deploy—we will stray from this process and use our best judgement to get higher-impact changes deployed more quickly.
16+
17+
We aim to have every new PR merged or closed within 30 days of opening. As outlined in the following sections, different types of pull requests do have different levels of priority, and this may influence how promptly a pull request is acted on.
18+
19+
### Translations
20+
21+
Translation pull requests are considered high priority. These are when the translated and reviewed files from our translation management platform are submitted as a pull request. They are important to our core value of bringing Ethereum education to as many languages as possible. They also are the accumulation of months of work by translators and reviewers, and any delay to this already long process is undesirable.
22+
23+
**Timeline:** PRs should be merged within 1-4 days of opening (by the next release).
24+
25+
### Feature and bug fixes
26+
27+
Any new feature correlated to an approved issue or bug fix is high-priority. Similar to translators, code contributors dedicate a large amount of their time to improving [ethereum.org](http://ethereum.org) as a resource and addressing their efforts quickly is desirable. All bug fixes should be handled swiftly, but new features that were not discussed, requested or approved do not fall under this timeline.
28+
29+
**Timeline:** Features or bug fixes should be reviewed within 1-12 days. In the case of bugs, more severe bugs will be reviewed more promptly.
30+
31+
### Content
32+
33+
Content PRs are considered medium-priority. Depending on their content, they can be very high-impact but also a high effort to go through the various stages of content review to ensure the content meets the standards we aim for. Content PRs can be broken into two categories: major content (e.g. a new page) and minor content changes (e.g. a new section to an existing page). Typo or grammar fixes are considered separately.
34+
35+
**Timeline:** Major content should be merged within 15-30 days of opening. Minor content changes within 5-15 days of opening.
36+
37+
### Typographical and grammatical errors
38+
39+
Typographical and grammatical errors are medium-priority as small errors of this kind can have second-order ramifications for the linguists of the ~50 languages we currently translate to. Though technically a subgroup of ‘content PRs’, typos and grammar errors take significantly less time to review and, as a result, are treated differently.
40+
41+
**Timeline:** Typo or grammar pull requests should be merged within 1-8 days of opening.
42+
43+
### Adding products
44+
45+
Adding new products is currently a low-to-medium priority (depending on the type of product). These pull requests often take a long time to review as we must extensively research products to ensure we not sending our users to any dubious or unsafe products.
46+
47+
**Timeline:** PRs should be closed or merged within 30 days of opening.
48+
49+
### Adding tutorials
50+
51+
Adding new tutorials to [ethereum.org](http://ethereum.org) is currently low-priority. We are currently in the middle of an epic to revamp our tutorials. As part of this, we’ll be reviewing our existing tutorials, purging outdated or low-quality tutorials, and refining our listing criteria for future tutorials to meet our increased standards. Please always create an issue to discuss the usefulness of your proposed tutorial before opening a PR.
52+
53+
**Timeline:** PRs should be closed or merged within 30 days of opening.

docs/stack.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Gatsby Docs](https://www.gatsbyjs.org/docs/)
1010
- [React](https://reactjs.org/) - A JavaScript library for building component-based user interfaces
1111
- [Typescript](https://www.typescriptlang.org/) - TypeScript is a strongly typed programming language that builds on JavaScript
12+
- [Chakra UI](https://chakra-ui.com/) - A UI library (Migration in progress)
1213
- [GraphQL](https://graphql.org/) - A query language for APIs
1314
- [Algolia](https://www.algolia.com/) - Site indexing, rapid intra-site search results, and search analytics. [Learn more on how we implement Algolia for site search](./docs/ALGOLIA_DOCSEARCH.md).
1415
- Primary implementation: `/src/components/Search/index.ts`

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-
export const wrapPageElement: GatsbyBrowser<
35-
any,
36-
Context
37-
>["wrapPageElement"] = ({ element, props }) => {
38-
const { location, pageContext } = props
39-
const { pathname, search } = location
40-
const { originalPath } = pageContext
41-
42-
const [, pathLocale] = pathname.split("/")
43-
44-
// client side redirect on paths that don't have a locale in them. Most useful
45-
// on dev env where we don't have server redirects
46-
if (IS_DEV && !isLang(pathLocale)) {
47-
let detected =
48-
window.localStorage.getItem("eth-org-language") ||
49-
browserLang({
50-
languages: supportedLanguages,
51-
fallback: defaultLanguage,
52-
})
53-
54-
if (!isLang(detected)) {
55-
detected = defaultLanguage
56-
}
57-
58-
const queryParams = search || ""
59-
const newUrl = withPrefix(`/${detected}${originalPath}${queryParams}`)
60-
window.localStorage.setItem("eth-org-language", detected)
61-
window.location.replace(newUrl)
62-
63-
// can't return null here, must return an element
64-
return <div />
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)