-
Notifications
You must be signed in to change notification settings - Fork 179
[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
Open
Divyansh013
wants to merge
22
commits into
processing:main
Choose a base branch
from
Divyansh013:week2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
46edaf0
Test: Add documentation line to circle.mdx for translation tracker te…
Divyansh013 ba9b4ee
Add Week 1 translation tracker implementation
Divyansh013 cd94f24
Test: Modify triangle.mdx for translation testing
Divyansh013 ddebbf3
Test: Modify accelerationX.mdx to test missing translation detection
Divyansh013 1e13287
removed testing logs
Divyansh013 875a77c
small fix
Divyansh013 5170eb6
post review changes
Divyansh013 56abeec
Week 2: Translation tracker with GitHub API and Hindi focus
Divyansh013 d9c98c6
Test: Update English example for translation tracker testing
Divyansh013 1976d9d
Fix: Add automatic branch detection to translation tracker
Divyansh013 71e7049
week 2 complete
Divyansh013 94159c8
Week 3: Test automated translation tracking
Divyansh013 f03b60d
Add manual trigger support to translation tracker workflow
Divyansh013 dea5e7c
Test: Manual trigger detection test
Divyansh013 486aded
Simplify translation tracker - clean output
Divyansh013 63753de
Add scan all files option to index.js
Divyansh013 9f63c9d
final fix
Divyansh013 8de0a67
temp commit
Divyansh013 18bd739
basic version complete
Divyansh013 7fb683c
readme updated and simplified scanning
Divyansh013 034694a
review fix
Divyansh013 7f55a56
updated manifest
Divyansh013 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This already looks generalized, which is great