feat(i18n): add ?lang= support to /api/wrapped (Year in Review) badge#5803
Open
vanshikaMaheshwari wants to merge 2 commits into
Open
feat(i18n): add ?lang= support to /api/wrapped (Year in Review) badge#5803vanshikaMaheshwari wants to merge 2 commits into
vanshikaMaheshwari wants to merge 2 commits into
Conversation
Contributor
|
@vanshikaMaheshwari is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
Aamod-Dev
approved these changes
Jun 18, 2026
Aamod-Dev
left a comment
Collaborator
There was a problem hiding this comment.
Difficulty: intermediate – Adds ?lang= i18n support to /api/wrapped Year in Review badge.
Quality: clean – Internationalization.
Type: feature – Localization support.
Great i18n feature!
Aamod-Dev
approved these changes
Jun 20, 2026
Aamod-Dev
left a comment
Collaborator
There was a problem hiding this comment.
Review
Already labeled. Adds lang parameter to wrappedParamsSchema and passes it to wrapped SVG generation. Includes i18n test coverage.
Approved! 🚀
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #5787
What does this PR do?
Adds
langquery parameter support to the/api/wrapped("Year in Review") badge, bringing it in line with every other badge in the CommitPulse family (/api/streak, monthly stats, heatmap, versus, languages, etc.).Problem
The
/api/wrappedbadge had all 5 label strings (TOTAL CONTRIBUTIONS,TOP LANGUAGE,WEEKEND GRIND,PEAK DAY,BUSIEST MONTH) hardcoded in English inside the SVG template. Passing?lang=hi(or any other supported language) had no effect, breaking the localization promise advertised for the rest of the badge family.Changes
lib/i18n/badgeLabels.ts— extendedBadgeLabelsinterface with 5 new wrapped-specific keys and added translations for all 10 existing locales (en,zh,es,hi,pt,ko,ja,fr,ta,de)lib/validations.ts— addedlang: z.enum(supportedLanguages).catch('en').default('en')towrappedParamsSchemaapp/api/wrapped/route.ts— destructuredlangfrom parsed params and passed it intoBadgeParamslib/svg/generator.ts— calledgetLabels(params.lang)ingenerateWrappedSVGand replaced all 5 hardcoded English strings with label lookupslib/i18n/badgeLabels.test.ts— addedwrapped / year-in-review keysdescribe blockapp/api/wrapped/tests/i18n.test.ts— new test file covering schema defaulting, all locales accepted, unsupported locale coercion, and translation spot-checks for Hindi, Japanese, and FrenchPillar
Visual Preview
Before (
?lang=hi): labels render in EnglishAfter (
?lang=hi): labels render in HindiChecklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.