Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
46edaf0
Test: Add documentation line to circle.mdx for translation tracker te…
Divyansh013 Jun 9, 2025
ba9b4ee
Add Week 1 translation tracker implementation
Divyansh013 Jun 9, 2025
cd94f24
Test: Modify triangle.mdx for translation testing
Divyansh013 Jun 9, 2025
ddebbf3
Test: Modify accelerationX.mdx to test missing translation detection
Divyansh013 Jun 9, 2025
1e13287
removed testing logs
Divyansh013 Jun 9, 2025
875a77c
small fix
Divyansh013 Jun 12, 2025
5170eb6
post review changes
Divyansh013 Jun 13, 2025
56abeec
Week 2: Translation tracker with GitHub API and Hindi focus
Divyansh013 Jun 15, 2025
d9c98c6
Test: Update English example for translation tracker testing
Divyansh013 Jun 15, 2025
1976d9d
Fix: Add automatic branch detection to translation tracker
Divyansh013 Jun 15, 2025
71e7049
week 2 complete
Divyansh013 Jun 22, 2025
94159c8
Week 3: Test automated translation tracking
Divyansh013 Jul 6, 2025
f03b60d
Add manual trigger support to translation tracker workflow
Divyansh013 Jul 6, 2025
dea5e7c
Test: Manual trigger detection test
Divyansh013 Jul 6, 2025
486aded
Simplify translation tracker - clean output
Divyansh013 Jul 6, 2025
63753de
Add scan all files option to index.js
Divyansh013 Jul 6, 2025
9f63c9d
final fix
Divyansh013 Jul 6, 2025
8de0a67
temp commit
Divyansh013 Aug 11, 2025
18bd739
basic version complete
Divyansh013 Aug 18, 2025
7fb683c
readme updated and simplified scanning
Divyansh013 Aug 21, 2025
034694a
review fix
Divyansh013 Sep 1, 2025
afdc086
Add translation tracking GitHub Action
Divyansh013 Sep 2, 2025
dcd32e5
Merge branch 'main' into action-only-main
ksen0 Sep 4, 2025
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
118 changes: 118 additions & 0 deletions .github/actions/translation-tracker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# p5.js Translation Tracker

Automatically tracks translation status for p5.js website examples, creates GitHub issues for outdated translations, and shows banners on the website.

## Features

- Detects outdated/missing translations using Git commit comparison (currently focused on Examples content)
- Creates GitHub issues with diff snippets and action checklists
- Shows localized banners on outdated translation pages
- Supports Spanish, Hindi, Korean, and Chinese Simplified

## File Structure

```
.github/actions/translation-tracker/
├── index.js # Main tracker logic
├── package.json # Dependencies
├── test-local.js # Local testing
src/layouts/ExampleLayout.astro # Banner integration
src/components/OutdatedTranslationBanner/ # Banner component
public/translation-status/examples.json # Generated status (build artifact)
```

## Usage

### Local Testing
```bash
cd .github/actions/translation-tracker && npm install
node test-local.js
```

### Scan All Files (File-based)
```bash
node .github/actions/translation-tracker/index.js
```

### Scan All Files (GitHub API + Create Issues)
```bash
GITHUB_TOKEN=your_token GITHUB_REPOSITORY=owner/repo node .github/actions/translation-tracker/index.js
```

### GitHub Actions Workflow
Create `.github/workflows/translation-sync.yml`:

```yaml
name: Translation Sync Tracker

on:
push:
branches: [main, week2]
paths: ['src/content/examples/en/**']
workflow_dispatch:

jobs:
track-translation-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: npm ci

- name: Install translation tracker dependencies
run: cd .github/actions/translation-tracker && npm install

- name: Run translation tracker
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .github/actions/translation-tracker/index.js
```
## Environment Variables
- `GITHUB_TOKEN` - Required for GitHub API and issue creation
- `GITHUB_REPOSITORY` - Format: `owner/repo` (auto-detected in Actions)

## What It Does

1. **Scans** English example files for changes
2. **Compares** with translation files using Git commits
3. **Creates** GitHub issues for outdated translations with:
- Diff snippets showing what changed
- Links to files and comparisons
- Action checklist for translators
- Proper labels (`needs translation`, `lang-es`, etc.)
4. **Generates** manifest file for website banner system
5. **Shows** localized banners on outdated translation pages

## Sample Output

```
📝 Checking 61 English example file(s)

📊 Translation Status Summary:
🔄 Outdated: 48
❌ Missing: 0
✅ Up-to-date: 196

🎫 GitHub issues created: 12
- Issue #36: Spanish, Hindi, Korean, Chinese Simplified need updates
- URL: https://github.com/owner/repo/issues/36

🗂️ Wrote translation manifest: public/translation-status/examples.json
```
## Dependencies
- `@actions/core`, `@actions/github`, `@octokit/rest`
- Node.js built-ins: `fs`, `path`, `child_process`
Loading
Loading