-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add localization to Payroll components #534
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
Conversation
jeffredodd
commented
Sep 9, 2025
- Added useI18n hooks to 4 Payroll presentation components for dynamic translation loading
- Created translation files for PayrollOverview and PayrollEditEmployee components
- Updated PayrollConfiguration translations with missing alert strings
- Fixed PayrollList to use existing translations instead of hardcoded text
- Updated tests to verify real translated text instead of translation keys
9855be8
to
25ac84a
Compare
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.
Pull Request Overview
This PR adds internationalization (i18n) support to Payroll components by replacing hardcoded English strings with dynamic translations. The changes enable these components to support multiple languages through the existing i18n infrastructure.
- Added useI18n hooks and useTranslation to 4 Payroll presentation components
- Created new translation files for PayrollOverview and PayrollEditEmployee components
- Updated PayrollConfiguration translations with missing alert strings and fixed PayrollList to use existing translations
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/i18n/en/Payroll.PayrollOverview.json | New translation file with page titles, buttons, alerts, and table headers |
src/i18n/en/Payroll.PayrollEditEmployee.json | New translation file with page title, form labels, and button text |
src/i18n/en/Payroll.PayrollConfiguration.json | Added missing alert translations for payroll deadline and skipped employees |
src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.tsx | Added i18n hooks and replaced hardcoded strings with translation calls |
src/components/Payroll/PayrollList/PayrollListPresentation.tsx | Fixed hardcoded "Run payroll" string to use existing translation |
src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.tsx | Added i18n hooks and replaced hardcoded strings with translation calls |
src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx | Added i18n hook and replaced hardcoded alert strings with translations |
src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.test.tsx | Updated tests to verify actual translated text instead of translation keys |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.tsx
Show resolved
Hide resolved
25ac84a
to
367ebd8
Compare
await waitFor(() => { | ||
expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument() | ||
}) |
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.
Nit: we can also do findByRole
here on the first assertion which automatically will account for the wait for
<Alert label={t('alerts.payrollDeadline.label')} status="info"> | ||
{t('alerts.payrollDeadline.message')} | ||
</Alert> | ||
|
||
{/* TODO: Replace with actual skipped employees list from payroll data */} | ||
<Alert label="Skipped Employees" status="warning"> | ||
<Alert label={t('alerts.skippedEmployees.label')} status="warning"> | ||
<ul> | ||
<li>Employee address not verified</li> | ||
<li>Employee address not verified</li> | ||
<li>{t('alerts.skippedEmployees.employeeAddressNotVerified')}</li> | ||
<li>{t('alerts.skippedEmployees.employeeAddressNotVerified')}</li> |
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 text may be dynamic, maybe worth holding off on adding it until we wire it up in the ticket itself? i'd also be ok just removing these components until they actually get implemented
useI18n('Payroll.PayrollEditEmployee') | ||
const { t } = useTranslation('Payroll.PayrollEditEmployee') | ||
const formHandlers = useForm() | ||
return ( | ||
<Flex flexDirection="column" gap={20}> | ||
<Heading as="h2">{`Edit Hannah Arendt's payroll`}</Heading> | ||
<Heading as="h2">{t('pageTitle', { employeeName: 'Hannah Arendt' })}</Heading> | ||
<Heading as="h1">$1,173.08</Heading> | ||
<Text>Gross pay</Text> | ||
<Heading as="h3">Regular hours</Heading> | ||
<Text>{t('labels.grossPay')}</Text> | ||
<Heading as="h3">{t('labels.regularHours')}</Heading> | ||
<FormProvider {...formHandlers}> | ||
<Form> | ||
<NumberInputField defaultValue={40} isRequired label="Hours" name="hours" /> | ||
<NumberInputField defaultValue={40} isRequired label={t('labels.hours')} name="hours" /> | ||
</Form> | ||
</FormProvider> | ||
|
||
<Button onClick={onDone} title="Done"> | ||
Done | ||
<Button onClick={onDone} title={t('buttons.doneTitle')}> | ||
{t('buttons.done')} |
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.
Can we just remove the translations added to this file? i have it implemented for the Edit ticket in progress and it'll just result in merge conflicts 😅
<Flex flexDirection="column" alignItems="stretch"> | ||
<Flex justifyContent="space-between"> | ||
<Heading as="h1">Review payroll for Jul 5 - Jul 18, 2025</Heading> | ||
<Heading as="h1">{t('pageTitle', { startDate: 'Jul 5', endDate: 'Jul 18, 2025' })}</Heading> |
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.
You may want to communicate with the team before adding this one? i think dmitriy may be working in this file?
367ebd8
to
25ac84a
Compare
- Add useI18n hooks to all Payroll presentation components - Create translation files for PayrollOverview and PayrollEditEmployee - Update PayrollConfiguration with alert translations - Fix PayrollList to use existing translations properly - Add proper useI18n mocking to tests - All Payroll stories now show localized strings in Ladle - 28 user-facing strings now properly localized
25ac84a
to
d1b6c8b
Compare