Add translated success toast for contact form#26
Open
wiatrM wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a localized success message for contact form submissions and wires up translated toasts in two components.
- Introduce
contact.form.successtranslation key in English and Polish JSON files - Update
defaultTranslationsinLanguageContext.tsxwith the new key - Refactor
EnhancedContactandContactcomponents to uset('contact.form.success')and replace static toasts with translated messages
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| public/translations/pl.json | Add success key under contact.form |
| public/translations/en.json | Add success key under contact.form |
| contexts/LanguageContext.tsx | Include success in default contact.form mapping |
| components/enhanced-contact.tsx | Replace common.success toast with contact.form.success |
| components/contact.tsx | Hook up useLanguage, replace static toasts with translations |
Comments suppressed due to low confidence (1)
components/enhanced-contact.tsx:42
- [nitpick] The new behavior of showing a translated success toast isn't covered by existing tests. Consider adding a unit or integration test that verifies the toast is triggered with the correct translation key after a successful submission.
toast({ title: t('contact.form.success') });
| setFormData({ name: '', email: '', company: '', message: '' }); | ||
| } else { | ||
| toast({ title: 'Error', variant: 'destructive' }); | ||
| toast({ title: t('common.error'), variant: 'destructive' }); |
There was a problem hiding this comment.
The translation key 'common.error' isn't defined in your JSON files or defaultTranslations, so the toast will fall back to the literal key. Either add common.error to your translation sources or use an existing key (e.g., contact.form.error).
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.
Summary
Testing
npm run lintnpm run buildnpm testnpm run test:e2e(fails: Executable doesn't exist at /root/.cache/ms-playwright/...)npm run type-check(fails: Missing script)npm run test:a11y(fails: Missing script)npm run lighthouse(fails: Chrome installation not found)https://chatgpt.com/codex/tasks/task_e_68664ded585083258d5853ca52085f7c