diff --git a/.github/workflows/translate.yml b/.github/workflows/translate.yml new file mode 100644 index 00000000..70156b7d --- /dev/null +++ b/.github/workflows/translate.yml @@ -0,0 +1,52 @@ +name: Translate + +on: + push: + branches: [main] + +permissions: + contents: write + +jobs: + translate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --filter @kan/web... + + - name: Extract translations + working-directory: apps/web + run: pnpm lingui:extract + + - name: Lingo.dev + uses: lingodotdev/lingo.dev@main + with: + api-key: ${{ secrets.LINGODOTDEV_API_KEY }} + commit-message: chore: update translations + working-directory: apps/web + parallel: true + + - name: Compile translations + working-directory: apps/web + run: pnpm lingui:compile + + - name: Commit compiled translations + run: | + git config --local user.email "hjball@users.noreply.github.com" + git config --local user.name "hjball" + git add apps/web/src/locales/*/messages.{js,ts} + git diff --staged --quiet || git commit -m "chore: compile translations" + git push