Skip to content

Commit 02419da

Browse files
committed
Merge branch 'dev' into website-update
2 parents 9af3b03 + 179fdf8 commit 02419da

File tree

202 files changed

+1596
-1064
lines changed

Some content is hidden

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

202 files changed

+1596
-1064
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IS_PREVIEW_DEPLOY=false
2929
# Build pages only for the specified langs. Leave it empty to build all the langs
3030
# e.g. `en,fr` will only build English and French pages
3131
# Note: always include `en` as it is the default lang of the site
32-
BUILD_LOCALES=
32+
NEXT_PUBLIC_BUILD_LOCALES=
3333

3434
# If resource constraints are being hit during builds, change LIMIT_CPUS to a
3535
# fixed number of CPUs (e.g. 2) to limit the demand during build time

.eslintrc.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@
6363
"varsIgnorePattern": "^_$"
6464
}
6565
],
66-
"unused-imports/no-unused-imports-ts": "warn",
67-
"no-restricted-imports": [
68-
"warn",
69-
{
70-
"paths": [
71-
{
72-
"name": "react-i18next",
73-
"message": "Please use next-i18next instead of react-i18next."
74-
}
75-
]
76-
}
77-
]
66+
"unused-imports/no-unused-imports-ts": "warn"
7867
}
7968
}

.github/labeler.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"config ⚙️":
1717
- i18n.config.json
1818
- next.config.js
19-
- next-i18next.config,js
2019
- next-sitemap.config.js
2120
- tsconfig.json
2221
- .nvmrc

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ const config: StorybookConfig = {
2828
},
2929
},
3030
"@storybook/addon-interactions",
31-
"storybook-react-i18next",
3231
"@storybook/addon-themes",
3332
"@chromatic-com/storybook",
33+
"storybook-next-intl",
3434
],
3535
staticDirs: ["../public"],
3636
framework: {

.storybook/modes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pickBy from "lodash/pickBy"
22

3-
import { baseLocales } from "./i18next"
3+
import { baseLocales } from "./next-intl"
44
import { breakpointSet } from "./preview"
55

66
export const viewportModes = breakpointSet.reduce<{

.storybook/i18next.ts renamed to .storybook/next-intl.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import i18n, { Resource } from "i18next"
2-
// eslint-disable-next-line no-restricted-imports
3-
import { initReactI18next } from "react-i18next"
4-
51
export const baseLocales = {
62
en: { title: "English", left: "En" },
73
zh: { title: "中国人", left: "Zh" },
@@ -32,7 +28,7 @@ const supportedLngs = Object.keys(baseLocales)
3228
/**
3329
* Taking the ns array and generating those files for each language available.
3430
*/
35-
const resources: Resource = ns.reduce((acc, n) => {
31+
const messagesByLocale = ns.reduce((acc, n) => {
3632
supportedLngs.forEach((lng) => {
3733
if (!acc[lng]) acc[lng] = {}
3834

@@ -57,16 +53,18 @@ const resources: Resource = ns.reduce((acc, n) => {
5753

5854
return acc
5955
}, {})
60-
console.log("🚀 ~ constresources:Resource=ns.reduce ~ resources:", resources)
56+
console.log(
57+
"🚀 ~ constresources:Resource=ns.reduce ~ resources:",
58+
messagesByLocale
59+
)
6160

62-
i18n.use(initReactI18next).init({
63-
debug: true,
64-
fallbackLng: "en",
65-
interpolation: { escapeValue: false },
66-
react: { useSuspense: false },
67-
supportedLngs,
68-
resources,
69-
defaultNS: "common",
70-
})
61+
const nextIntl = {
62+
defaultLocale: "en",
63+
messagesByLocale,
64+
getMessageFallback: ({ key }: { key: string }) => {
65+
const keyOnly = key.split(".").pop()
66+
return keyOnly || key
67+
},
68+
}
7169

72-
export default i18n
70+
export default nextIntl

.storybook/preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Preview } from "@storybook/react"
55
import ThemeProvider from "@/components/ThemeProvider"
66
import { TooltipProvider } from "@/components/ui/tooltip"
77

8-
import i18n, { baseLocales } from "./i18next"
8+
import nextIntl, { baseLocales } from "./next-intl"
99
import { withNextThemes } from "./withNextThemes"
1010

1111
import "../src/styles/global.css"
@@ -47,7 +47,7 @@ const preview: Preview = {
4747
),
4848
],
4949
parameters: {
50-
i18n,
50+
nextIntl,
5151
controls: {
5252
matchers: {
5353
color: /(background|color)$/i,

.storybook/utils.ts

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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ yarn dev
9595
- Open this directory in your favorite text editor / IDE, and see your changes live by visiting `localhost:3000` from your browser
9696
- Pro Tip:
9797
- Explore scripts within `package.json` for more build options
98-
- Get **faster** production builds by building only one language. E.g. in your `.env` file, set `BUILD_LOCALES=en` to build the content only in English
99-
- To build the site in other selected languages too, you need to set them in `BUILD_LOCALES`, eg: `BUILD_LOCALES=en,es` if you also want to build only English (required) and Spanish.
100-
- To build all languages, simply comment this line out with a hash mark, eg: `# BUILD_LOCALES=`
98+
- Get **faster** production builds by building only one language. E.g. in your `.env` file, set `NEXT_PUBLIC_BUILD_LOCALES=en` to build the content only in English
99+
- To build the site in other selected languages too, you need to set them in `NEXT_PUBLIC_BUILD_LOCALES`, eg: `NEXT_PUBLIC_BUILD_LOCALES=en,es` if you also want to build only English (required) and Spanish.
100+
- To build all languages, simply comment this line out with a hash mark, eg: `# NEXT_PUBLIC_BUILD_LOCALES=`
101101

102102
By default the script will build all the languages (complete list in `i18n.config.json`).
103103

@@ -168,7 +168,7 @@ Learn more about how we review pull requests [here](docs/review-process.md).
168168

169169
- To help with verification we request GitHub contributors connect their GitHub account with their Discord account (Discord > Settings > Connections > GitHub). Crowdin contributors will be verified directly through Crowdin by our team.
170170

171-
If you haven't contributed yet and would like to earn a POAP/OATs to show your loyalty to the Ethereum space, head over to the [issues](https://github.com/ethereum/ethereum-org-website/issues/) tab to get started! If you would like to contribute to translations check out our [Translation Program](https://ethereum.org/en/contributing/translation-program/).
171+
If you haven't contributed yet and would like to earn a POAP/OATs to show your loyalty to the Ethereum space, head over to the [issues](https://github.com/ethereum/ethereum-org-website/issues/) tab to get started! If you would like to contribute to translations check out our [Translation Program](https://ethereum.org/en/contributing/translation-program/).
172172

173173
<hr style="margin-top: 3em; margin-bottom: 3em;">
174174

docs/best-practices.md

Lines changed: 2 additions & 2 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: using the `t` function from `next-i18next`
55+
- This is done using the `Translation` component. However there is an alternative method for regular JS: using the `t` function from `@/hooks/useTranslation`
5656

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

@@ -66,7 +66,7 @@ Markdown will be translated as whole pages of content, so no specific action is
6666
- **Method two: `t()`**
6767

6868
```tsx
69-
import { useTranslation } from "next-i18next"
69+
import { useTranslation } from "@/hooks/useTranslation"
7070
7171
// Utilize anywhere in JS using
7272
const { t } = useTranslation()

0 commit comments

Comments
 (0)