Commit bd23853
authored
fix(validation): validate lang parameter against supported languages keys (JhaSourav07#1889)
## Description
Fixes JhaSourav07#1796
### Changes Made
- Added `supportedLanguages` derived from translation keys in
`badgeLabels.ts`
- Updated `streakParamsSchema` to validate `lang` using `z.enum()`
- Added `.catch('en')` fallback behavior for unsupported language inputs
- Preserved default English fallback behavior
### Verification
- [x] npm run format
- [x] npm run lint
- [x] npm run test
- [x] npm run typecheck
- [x] Verified invalid lang values fall back to `en`
### Result
- Valid language inputs continue to work correctly
- Unsupported language values now safely fall back to English (`en`)
- Prevents downstream localization lookup failures during SVG generation3 files changed
Lines changed: 17 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments