Skip to content

Commit 2de39bc

Browse files
committed
Merge branch 'dev' into fixed-locale-prefix
2 parents 0f18c9a + d70c495 commit 2de39bc

File tree

403 files changed

+7558
-4380
lines changed

Some content is hidden

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

403 files changed

+7558
-4380
lines changed

.all-contributorsrc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12078,6 +12078,51 @@
1207812078
"contributions": [
1207912079
"code"
1208012080
]
12081+
},
12082+
{
12083+
"login": "mingoing",
12084+
"name": "Mingo",
12085+
"avatar_url": "https://avatars.githubusercontent.com/u/344175?v=4",
12086+
"profile": "https://github.com/mingoing",
12087+
"contributions": [
12088+
"doc"
12089+
]
12090+
},
12091+
{
12092+
"login": "zkVlad",
12093+
"name": "zkVlad",
12094+
"avatar_url": "https://avatars.githubusercontent.com/u/125317045?v=4",
12095+
"profile": "https://github.com/zkVlad",
12096+
"contributions": [
12097+
"doc"
12098+
]
12099+
},
12100+
{
12101+
"login": "yunseonna",
12102+
"name": "yunseon na",
12103+
"avatar_url": "https://avatars.githubusercontent.com/u/148749864?v=4",
12104+
"profile": "https://github.com/yunseonna",
12105+
"contributions": [
12106+
"doc"
12107+
]
12108+
},
12109+
{
12110+
"login": "alex1092",
12111+
"name": "Alex",
12112+
"avatar_url": "https://avatars.githubusercontent.com/u/59183749?v=4",
12113+
"profile": "https://github.com/alex1092",
12114+
"contributions": [
12115+
"code"
12116+
]
12117+
},
12118+
{
12119+
"login": "kyndrawynne",
12120+
"name": "kyndrawynne",
12121+
"avatar_url": "https://avatars.githubusercontent.com/u/108100622?v=4",
12122+
"profile": "https://github.com/kyndrawynne",
12123+
"contributions": [
12124+
"bug"
12125+
]
1208112126
}
1208212127
],
1208312128
"contributorsPerLine": 7,

.eslintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
["^@/data"],
3131
// From the `constants` directory.
3232
["^@/lib/constants"],
33+
// From the `.storybook/utils` file
34+
["^@/storybook-utils"],
3335
// Parent imports. Put `..` last.
3436
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
3537
// Other relative imports. Put same-folder imports and `.` last.

.github/labeler.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@
2929
"translation 🌍":
3030
- public/content/translations/**/*
3131
- src/intl/**/*
32-
- !src/intl/en/**
3332

3433
"content 🖋️":
3534
- src/intl/en/**
3635
- public/content/**/*
37-
- !public/content/translations/**/*
3836

3937
"event 📅":
4038
- src/data/community-events.json

.github/workflows/build-crowdin.yml

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

.github/workflows/crowdin-ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Crowdin CI
2+
3+
on:
4+
schedule:
5+
- cron: "20 4 1 * *" # Runs at 4:20 AM on the first day of every month
6+
workflow_dispatch: # Can be dispatched manually
7+
8+
jobs:
9+
create_approved_language_bucket_prs:
10+
runs-on: ubuntu-latest
11+
env:
12+
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
13+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
16+
steps:
17+
# Set up environment
18+
- name: Check out code
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
26+
- name: Install dependencies
27+
run: yarn install
28+
29+
- name: Install ts-node
30+
run: yarn global add ts-node
31+
32+
- name: Set up git
33+
run: |
34+
git config --global user.email "[email protected]"
35+
git config --global user.name "GitHub Action"
36+
37+
- name: Fetch latest dev
38+
run: git fetch origin dev
39+
40+
# Build translations
41+
- name: Build Crowdin project
42+
id: build-crowdin
43+
run: |
44+
npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts;
45+
grep BUILD_ID output.env >> $GITHUB_ENV;
46+
47+
- name: Await latest build to finish
48+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/awaitLatestBuild.ts
49+
50+
- name: Check build success
51+
run: |
52+
if [ $(grep BUILD_SUCCESS output.env | cut -d'=' -f2) = false ]; then
53+
echo "Build timed out, exiting"
54+
exit 1
55+
fi
56+
shell: bash
57+
58+
# Prepare bucket ids
59+
- name: Get latest translation bucket directory ids
60+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getBucketDirectoryIds.ts
61+
62+
# Import approved translations
63+
- name: Get translations
64+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getTranslations.ts
65+
66+
# Post updates as language-specific PRs
67+
- name: Process commits and post PRs by language
68+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/postLangPRs.ts

.github/workflows/get-translations.yml

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

.github/workflows/label.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,26 @@ jobs:
1111
- uses: actions/labeler@v2
1212
with:
1313
repo-token: "${{ secrets.GITHUB_TOKEN }}"
14+
15+
- name: Refine labels
16+
uses: actions/github-script@v5
17+
with:
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
script: |
20+
try {
21+
const { owner, repo, number: pull_number } = context.issue;
22+
const { data: files } = await github.pulls.listFiles({ owner, repo, pull_number });
23+
24+
const allInEn = files.every(file => file.filename.startsWith('src/intl/en/'));
25+
const allInTranslations = files.every(file => file.filename.startsWith('public/content/translations/'));
26+
27+
if (allInEn) {
28+
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'translation 🌍' });
29+
}
30+
31+
if (allInTranslations) {
32+
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'content 🖋️' });
33+
}
34+
} catch (error) {
35+
console.warn("Problem occurred refining labels")
36+
}

.github/workflows/non-english-warning.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,31 @@ on:
88
- "!src/intl/en/**"
99

1010
jobs:
11-
check_branch_name:
11+
check_and_label:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Exit early if branch name contains 'crowdin'
14+
- name: Exit early if branch name contains 'crowdin' or is 'dev', 'staging', or 'master'
15+
id: check_branch
1516
run: |
16-
if [[ "${{ github.head_ref }}" == *crowdin* ]]; then
17-
echo "Branch name contains 'crowdin', stopping workflow"
18-
exit 1
17+
if [[ "${{ github.head_ref }}" == *crowdin* ]] ||
18+
[[ "${{ github.ref }}" == 'refs/heads/dev' ]] ||
19+
[[ "${{ github.ref }}" == 'refs/heads/staging' ]] ||
20+
[[ "${{ github.ref }}" == 'refs/heads/master' ]]
21+
then
22+
echo "Branch name contains 'crowdin' or is 'dev', 'staging', or 'master', stopping workflow"
23+
echo "::set-output name=skip::true"
24+
exit 0
25+
else
26+
echo "::set-output name=skip::false"
1927
fi
2028
21-
check_changes:
22-
needs: check_branch_name
23-
runs-on: ubuntu-latest
24-
outputs:
25-
all_changes_include_href: ${{ steps.check.outputs.all_changes_include_href }}
26-
steps:
2729
- name: Checkout code
30+
if: steps.check_branch.outputs.skip == 'false'
2831
uses: actions/checkout@v2
32+
2933
- name: Check changes
30-
id: check
34+
if: steps.check_branch.outputs.skip == 'false'
35+
id: check_changes
3136
run: |
3237
git fetch origin ${{ github.base_ref }}
3338
DIFF=$(git diff --no-ext-diff --unified=0 origin/${{ github.base_ref }}..${{ github.head_ref }} -- 'public/content/translations/**/*.md' 'src/intl/**/*.json' '!src/intl/en/**' | grep -E -v '^[-+]href=')
@@ -38,27 +43,24 @@ jobs:
3843
fi
3944
echo "::set-output name=all_changes_include_href::$ALL_CHANGES_INCLUDE_HREF"
4045
41-
add_label_and_comment:
42-
needs: check_changes
43-
runs-on: ubuntu-latest
44-
steps:
4546
- name: Add label and comment
47+
if: steps.check_branch.outputs.skip == 'false'
4648
uses: actions/github-script@v5
4749
with:
4850
github-token: ${{secrets.GITHUB_TOKEN}}
4951
script: |
5052
const prNumber = context.issue.number;
5153
const repo = context.repo;
5254
const prAuthor = context.payload.pull_request.user.login;
53-
const allChangesIncludeHref = '${{ needs.check_changes.outputs.all_changes_include_href }}' === 'true';
54-
const status = allChangesIncludeHref ? 'question ❓' : 'blocked 🛑';
55+
const allChangesIncludeHref = '${{ steps.check_changes.outputs.all_changes_include_href }}' === 'true';
56+
const status = allChangesIncludeHref ? 'question ❓' : 'Status: Blocked 🛑';
5557
await github.rest.issues.addLabels({
5658
...repo,
5759
issue_number: prNumber,
5860
labels: [status, 'non-crowdin translation updates']
5961
});
6062
const commentWithoutHrefs = `This pull request contains changes to non-English content, which must also be handled through the Crowdin platform instead of only on GitHub.`
61-
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.
63+
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.`
6264
await github.rest.issues.createComment({
6365
...repo,
6466
issue_number: prNumber,
@@ -71,4 +73,4 @@ jobs:
7173
7274
Please post here or join [our Discord](https://ethereum.org/discord) if you have questions!
7375
`
74-
});
76+
});

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ robots.txt
5050
# .crowdin folder used as temp forlder for crowdin-import script
5151
.crowdin
5252

53-
# vscode workplace configuration
53+
# workplace configuration
5454
.vscode
55+
.idea
5556

5657
# Crowdin report output
5758
src/data/crowdin/bucketsAwaitingReviewReport.csv

.storybook/i18next.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ export const baseLocales = {
1010
}
1111

1212
// Only i18n files named in this array are being exposed to Storybook. Add filenames as necessary.
13-
const ns = [
13+
export const ns = [
1414
"common",
1515
"glossary",
16+
"learn-quizzes",
1617
"page-about",
1718
"page-index",
1819
"page-learn",
1920
"page-upgrades",
2021
"page-developers-index",
21-
]
22+
] as const
2223
const supportedLngs = Object.keys(baseLocales)
2324

2425
/**
@@ -49,6 +50,7 @@ const resources: Resource = ns.reduce((acc, n) => {
4950

5051
return acc
5152
}, {})
53+
console.log("🚀 ~ constresources:Resource=ns.reduce ~ resources:", resources)
5254

5355
i18n.use(initReactI18next).init({
5456
debug: true,
@@ -57,6 +59,7 @@ i18n.use(initReactI18next).init({
5759
react: { useSuspense: false },
5860
supportedLngs,
5961
resources,
62+
defaultNS: "common",
6063
})
6164

6265
export default i18n

0 commit comments

Comments
 (0)