Skip to content

Commit 7b468c0

Browse files
Free contributors from i18n data sync responsibility (#1515)
* Free contributors from i18n data sync responsibility * Update .github/workflows/check-i18n-task.yml Co-authored-by: per1234 <[email protected]> Co-authored-by: per1234 <[email protected]>
1 parent 664c9b6 commit 7b468c0

File tree

6 files changed

+9
-69
lines changed

6 files changed

+9
-69
lines changed

.github/workflows/check-i18n-task.yml

+4-42
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,15 @@ env:
66

77
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
88
on:
9-
create:
109
push:
11-
paths:
12-
- ".github/workflows/check-i18n-task.ya?ml"
13-
- "Taskfile.ya?ml"
14-
- "go.mod"
15-
- "go.sum"
16-
- "**.go"
17-
- "i18n/**"
18-
pull_request:
19-
paths:
20-
- ".github/workflows/check-i18n-task.ya?ml"
21-
- "Taskfile.ya?ml"
22-
- "go.mod"
23-
- "go.sum"
24-
- "**.go"
25-
- "i18n/**"
10+
branches:
11+
# Release branches have names like 0.8.x, 0.9.x, ...
12+
- "[0-9]+.[0-9]+.x"
2613
workflow_dispatch:
2714
repository_dispatch:
2815

2916
jobs:
30-
run-determination:
31-
runs-on: ubuntu-latest
32-
outputs:
33-
result: ${{ steps.determination.outputs.result }}
34-
steps:
35-
- name: Determine if the rest of the workflow should run
36-
id: determination
37-
run: |
38-
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
39-
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
40-
if [[ \
41-
"${{ github.event_name }}" != "create" || \
42-
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \
43-
]]; then
44-
# Run the other jobs.
45-
RESULT="true"
46-
else
47-
# There is no need to run the other jobs.
48-
RESULT="false"
49-
fi
50-
51-
echo "::set-output name=result::$RESULT"
52-
5317
check:
54-
needs: run-determination
55-
if: needs.run-determination.outputs.result == 'true'
5618
runs-on: ubuntu-latest
5719

5820
steps:
@@ -70,5 +32,5 @@ jobs:
7032
repo-token: ${{ secrets.GITHUB_TOKEN }}
7133
version: 3.x
7234

73-
- name: Check for errors
35+
- name: Check i18n source file is up to date
7436
run: task i18n:check

.github/workflows/i18n-nightly-push.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
repo-token: ${{ secrets.GITHUB_TOKEN }}
2727
version: 3.x
2828

29+
- name: Run task i18n:update
30+
run: task i18n:update
31+
2932
- name: Run task i18n:push
3033
run: task i18n:push
3134
env:

.github/workflows/i18n-weekly-pull.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
schedule:
55
# run every monday at 2AM
66
- cron: "0 2 * * 1"
7+
workflow_dispatch:
8+
repository_dispatch:
79

810
jobs:
911
pull-from-transifex:

Taskfile.yml

-8
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,11 @@ tasks:
261261
desc: Updates i18n files
262262
cmds:
263263
- go run ./i18n/cmd/main.go catalog generate . > ./i18n/data/en.po
264-
- task: i18n:generate
265264

266265
i18n:pull:
267266
desc: Pull i18n files from transifex
268267
cmds:
269268
- go run ./i18n/cmd/main.go transifex pull ./i18n/data
270-
- task: i18n:generate
271269

272270
i18n:push:
273271
desc: Push i18n files to transifex
@@ -281,12 +279,6 @@ tasks:
281279
- git add -N ./i18n/data
282280
- git diff --exit-code ./i18n/data
283281

284-
i18n:generate:
285-
desc: Generate embedded i18n catalog files
286-
cmds:
287-
- git add -N ./i18n/data
288-
- git diff --exit-code ./i18n/data &> /dev/null
289-
290282
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
291283
website:check:
292284
desc: Check whether the MkDocs-based website will build

docs/CONTRIBUTING.md

-16
Original file line numberDiff line numberDiff line change
@@ -322,22 +322,6 @@ In order to support i18n in the CLI, any messages that are intended to be transl
322322
`i18n.Tr`. This call allows us to build a catalog of translatable strings, replacing the reference string at runtime
323323
with the localized value.
324324

325-
Adding or modifying these messages requires an i18n update, as this process creates the reference catalog that is shared
326-
with translators. For that reason, the `task check` command will fail if the catalog was not updated to sync with
327-
changes to the source code.
328-
329-
To update the catalog, execute the following command and commit the changes.
330-
331-
```shell
332-
task i18n:update
333-
```
334-
335-
To verify that the catalog is up-to-date, you may execute the command:
336-
337-
```shell
338-
task i18n:check
339-
```
340-
341325
Example usage:
342326

343327
```golang

i18n/cmd/commands/transifex/pull_transifex.go

-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ func getLanguages() []string {
7070

7171
var langs []string
7272
for key := range jsonResp {
73-
if key == "en" {
74-
continue
75-
}
7673
langs = append(langs, key)
7774
}
7875

0 commit comments

Comments
 (0)