Skip to content

Free contributors from i18n data sync responsibility #1515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 4 additions & 42 deletions .github/workflows/check-i18n-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,15 @@ env:

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
create:
push:
paths:
- ".github/workflows/check-i18n-task.ya?ml"
- "Taskfile.ya?ml"
- "go.mod"
- "go.sum"
- "**.go"
- "i18n/**"
pull_request:
paths:
- ".github/workflows/check-i18n-task.ya?ml"
- "Taskfile.ya?ml"
- "go.mod"
- "go.sum"
- "**.go"
- "i18n/**"
branches:
# Release branches have names like 0.8.x, 0.9.x, ...
- "[0-9]+.[0-9]+.x"
workflow_dispatch:
repository_dispatch:

jobs:
run-determination:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
- name: Determine if the rest of the workflow should run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
if [[ \
"${{ github.event_name }}" != "create" || \
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \
]]; then
# Run the other jobs.
RESULT="true"
else
# There is no need to run the other jobs.
RESULT="false"
fi

echo "::set-output name=result::$RESULT"

check:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest

steps:
Expand All @@ -70,5 +32,5 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Check for errors
- name: Check i18n source file is up to date
run: task i18n:check
3 changes: 3 additions & 0 deletions .github/workflows/i18n-nightly-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Run task i18n:update
run: task i18n:update

- name: Run task i18n:push
run: task i18n:push
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/i18n-weekly-pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
schedule:
# run every monday at 2AM
- cron: "0 2 * * 1"
workflow_dispatch:
repository_dispatch:

jobs:
pull-from-transifex:
Expand Down
8 changes: 0 additions & 8 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,11 @@ tasks:
desc: Updates i18n files
cmds:
- go run ./i18n/cmd/main.go catalog generate . > ./i18n/data/en.po
- task: i18n:generate

i18n:pull:
desc: Pull i18n files from transifex
cmds:
- go run ./i18n/cmd/main.go transifex pull ./i18n/data
- task: i18n:generate

i18n:push:
desc: Push i18n files to transifex
Expand All @@ -281,12 +279,6 @@ tasks:
- git add -N ./i18n/data
- git diff --exit-code ./i18n/data

i18n:generate:
desc: Generate embedded i18n catalog files
cmds:
- git add -N ./i18n/data
- git diff --exit-code ./i18n/data &> /dev/null

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
website:check:
desc: Check whether the MkDocs-based website will build
Expand Down
16 changes: 0 additions & 16 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,22 +322,6 @@ In order to support i18n in the CLI, any messages that are intended to be transl
`i18n.Tr`. This call allows us to build a catalog of translatable strings, replacing the reference string at runtime
with the localized value.

Adding or modifying these messages requires an i18n update, as this process creates the reference catalog that is shared
with translators. For that reason, the `task check` command will fail if the catalog was not updated to sync with
changes to the source code.

To update the catalog, execute the following command and commit the changes.

```shell
task i18n:update
```

To verify that the catalog is up-to-date, you may execute the command:

```shell
task i18n:check
```

Example usage:

```golang
Expand Down
3 changes: 0 additions & 3 deletions i18n/cmd/commands/transifex/pull_transifex.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ func getLanguages() []string {

var langs []string
for key := range jsonResp {
if key == "en" {
continue
}
langs = append(langs, key)
}

Expand Down