-
Notifications
You must be signed in to change notification settings - Fork 170
[GSOC 2025]: Github action for translation tracker #895
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
base: main
Are you sure you want to change the base?
Changes from all commits
46edaf0
ba9b4ee
cd94f24
ddebbf3
1e13287
875a77c
5170eb6
56abeec
d9c98c6
1976d9d
71e7049
94159c8
f03b60d
dea5e7c
486aded
63753de
9f63c9d
8de0a67
18bd739
7fb683c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
- 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/**'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This already looks generalized, which is great |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks so much for the README updates! As one last thing, please include here or ~line 112 a short explanation/example of the |
||
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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor: add a note here please that it currently focuses on Examples content