Skip to content

Commit d1893ac

Browse files
authored
feat(i18n): add support for Weblate (#692)
* refactor(i18n): delete inactive messages * refactor(i18n): move strings files from translations to messages folder use 'meta' default settings and start translations of 'es-419' and 'th' * refactor(i18n): make intlLoader plugin accept options like the original from discord * fix(i18n): correct capitalization in German and Vietnamese translation strings * refactor(workflows): consolidate installation steps into a reusable action * feat(i18n): add workflow script for weblate support
1 parent 39a293f commit d1893ac

Some content is hidden

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

54 files changed

+873
-1311
lines changed

.github/actions/install/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Install
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Setup Node.js
7+
uses: actions/setup-node@v4
8+
with:
9+
node-version: 20
10+
11+
- name: Setup pnpm
12+
uses: pnpm/action-setup@v4
13+
14+
- name: Get pnpm store directory
15+
id: pnpm-cache
16+
shell: bash
17+
run: |
18+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
19+
20+
- name: Setup pnpm cache
21+
uses: actions/cache@v4
22+
with:
23+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
24+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
25+
restore-keys: |
26+
${{ runner.os }}-pnpm-store-
27+
28+
- name: Install dependencies
29+
shell: bash
30+
run: pnpm install

.github/workflows/cspell.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,20 @@ on:
88
branches:
99
- "*"
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
run-cspell:
1316
name: Run CSpell
1417
runs-on: ubuntu-latest
1518

1619
steps:
17-
- name: Check out Git repository
20+
- name: Checkout
1821
uses: actions/checkout@v4
1922

20-
- name: Set up Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 20
24-
25-
- uses: pnpm/action-setup@v4
26-
27-
- name: Get pnpm store directory
28-
id: pnpm-cache
29-
shell: bash
30-
run: |
31-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32-
33-
- uses: actions/cache@v4
34-
name: Setup pnpm cache
35-
with:
36-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
40-
41-
- name: Install dependencies
42-
run: pnpm install
23+
- name: Install
24+
uses: ./.github/actions/install
4325

4426
- name: Run CSpell
4527
run: pnpm run cspell:check

.github/workflows/eslint.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,20 @@ on:
88
branches:
99
- "*"
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
run-eslint:
1316
name: Run ESLint
1417
runs-on: ubuntu-latest
1518

1619
steps:
17-
- name: Check out Git repository
20+
- name: Checkout
1821
uses: actions/checkout@v4
1922

20-
- name: Set up Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 20
24-
25-
- uses: pnpm/action-setup@v4
26-
27-
- name: Get pnpm store directory
28-
id: pnpm-cache
29-
shell: bash
30-
run: |
31-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32-
33-
- uses: actions/cache@v4
34-
name: Setup pnpm cache
35-
with:
36-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
40-
41-
- name: Install dependencies
42-
run: pnpm install
23+
- name: Install
24+
uses: ./.github/actions/install
4325

4426
- name: Run ESLint
4527
run: pnpm run eslint:check

.github/workflows/prettier.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,20 @@ on:
88
branches:
99
- "*"
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
run-prettier:
1316
name: Run Prettier
1417
runs-on: ubuntu-latest
1518

1619
steps:
17-
- name: Check out Git repository
20+
- name: Checkout
1821
uses: actions/checkout@v4
1922

20-
- name: Set up Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 20
24-
25-
- uses: pnpm/action-setup@v4
26-
27-
- name: Get pnpm store directory
28-
id: pnpm-cache
29-
shell: bash
30-
run: |
31-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32-
33-
- uses: actions/cache@v4
34-
name: Setup pnpm cache
35-
with:
36-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
40-
41-
- name: Install dependencies
42-
run: pnpm install
23+
- name: Install
24+
uses: ./.github/actions/install
4325

4426
- name: Run Prettier
4527
run: pnpm run prettier:check

.github/workflows/release.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,20 @@ on:
55
tags:
66
- "v*"
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
release:
1013
name: Release
1114
runs-on: ubuntu-latest
12-
permissions:
13-
contents: write
1415

1516
steps:
16-
- name: Check out Git repository
17+
- name: Checkout
1718
uses: actions/checkout@v4
1819

19-
- name: Set up Node.js
20-
uses: actions/setup-node@v4
21-
with:
22-
node-version: 20
23-
24-
- uses: pnpm/action-setup@v4
25-
26-
- name: Install Node.js dependencies
27-
run: pnpm install
20+
- name: Install
21+
uses: ./.github/actions/install
2822

2923
- name: Build TypeScript and bundle into asar
3024
run: pnpm run bundle

.github/workflows/typescript.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,20 @@ on:
88
branches:
99
- "*"
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
run-typescript:
1316
name: Run TypeScript
1417
runs-on: ubuntu-latest
1518

1619
steps:
17-
- name: Check out Git repository
20+
- name: Checkout
1821
uses: actions/checkout@v4
1922

20-
- name: Set up Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 20
24-
25-
- uses: pnpm/action-setup@v4
26-
27-
- name: Get pnpm store directory
28-
id: pnpm-cache
29-
shell: bash
30-
run: |
31-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32-
33-
- uses: actions/cache@v4
34-
name: Setup pnpm cache
35-
with:
36-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
40-
41-
- name: Install dependencies
42-
run: pnpm install
23+
- name: Install
24+
uses: ./.github/actions/install
4325

4426
- name: Run TypeScript
4527
run: pnpm run typescript:check
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Update Messages
2+
3+
on:
4+
push:
5+
paths:
6+
- "i18n/messages/en-US.messages.json"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
generate-messages:
13+
name: Generate Messages
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install
21+
uses: ./.github/actions/install
22+
23+
- name: Run Generate Messages
24+
run: pnpm run generate-messages
25+
26+
- name: Publish
27+
run: |
28+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
29+
git config --global user.name "github-actions[bot]"
30+
31+
git add i18n
32+
git diff-index --quiet HEAD || git commit -m "chore(i18n): update en-US.messages.js [skip ci]"
33+
git push

0 commit comments

Comments
 (0)