-
-
Notifications
You must be signed in to change notification settings - Fork 0
Internationalization (i18n)
Ferran Buireu edited this page Feb 15, 2026
·
3 revisions
GitHub Star Tracker supports multiple languages for all user-facing content: reports, charts, badges, emails, and forecasts.
| Code | Language | Example Badge |
|---|---|---|
en |
English (default) | Total Stars |
es |
Spanish | Estrellas Totales |
ca |
Catalan | Estrelles Totals |
it |
Italian | Stelle Totali |
- uses: fbuireu/github-star-tracker@v1
with:
github-token: ${{ secrets.GITHUB_STAR_TRACKER_TOKEN }}
locale: 'es'# star-tracker.yml
locale: es| Content | Examples |
|---|---|
| Markdown report | Section titles, summary labels, trend indicators, footer |
| HTML email | Same as Markdown, plus subject line |
| SVG badge | Label text (Total Stars / Estrellas Totales / ...) |
| Charts | Axis date labels (formatted via locale-aware Date.toLocaleDateString) |
| Forecast tables | Method names, week labels, section titles |
| Stargazer section | Section title, count text, "starred on" dates |
| Email subject | Auto-generated localized subject line |
| Locale | Example Subject |
|---|---|
en |
GitHub Star Tracker Report: 523 (+15) |
es |
Informe de estrellas de GitHub: 523 (+15) |
ca |
Informe d'estrelles de GitHub: 523 (+15) |
it |
Rapporto stelle GitHub: 523 (+15) |
Translations live in src/i18n/ as flat JSON files:
src/i18n/
├── en.json # English translations
├── es.json # Spanish
├── ca.json # Catalan
├── it.json # Italian
├── index.ts # Loader, interpolation, validation
└── types.ts # Translations interface
Each JSON file implements the Translations interface with these sections:
| Section | Keys | Description |
|---|---|---|
badge |
totalStars |
Badge label text |
report |
title, total, change, comparedTo, firstRun, repositories, stars, starsCount, trend, newRepositories, removedRepositories, removedRepoText, summary, starsGained, starsLost, netChange, starTrend, starHistory, topRepositories, byRepository, individualRepoCharts, badges.new
|
Report sections and labels |
email |
subject, subjectLine, defaultFrom
|
Email content |
trends |
up, down, stable
|
Trend direction labels |
footer |
generated, madeBy
|
Report footer |
stargazers |
sectionTitle, newStargazers, starredOn, noNewStargazers, stargazerCount
|
Stargazer section |
forecast |
sectionTitle, predictedStars, week, linearRegression, weightedMovingAverage, aggregate, byRepository, insufficientData, method, predicted
|
Forecast tables |
Templates use {placeholder} syntax:
{
"comparedTo": "Compared to snapshot from {date}",
"starsCount": "{count} stars",
"week": "Week {n}"
}The interpolate() function replaces placeholders with provided values at render time. Unknown placeholders are left as-is.
If an invalid locale is provided:
- The action logs a warning:
Invalid locale "xx", falling back to "en" - English translations are used for the entire run
- The workflow does not fail
To contribute a new language:
- Copy
src/i18n/en.jsontosrc/i18n/{code}.json - Translate all values (keys stay in English)
- Keep
{placeholder}tokens untranslated - Add the import in
src/i18n/index.ts - Add the code to
LOCALESinsrc/config/defaults.ts - Add the code to
Localetype insrc/config/types.ts - Run
pnpm run validateto check everything passes
See Contributing for development setup.
-
Configuration —
localesetting - Email Notifications — Localized email subjects
- Star Trend Charts — Localized chart labels