Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jeffredodd
Copy link
Contributor

  • 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

Copy link
Contributor

@Copilot Copilot AI left a 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.

@jeffredodd jeffredodd force-pushed the jdj/payroll-localization branch from 25ac84a to 367ebd8 Compare September 9, 2025 21:06
Comment on lines +81 to +83
await waitFor(() => {
expect(screen.getByRole('heading', { level: 1 })).toBeInTheDocument()
})
Copy link
Member

@serikjensen serikjensen Sep 10, 2025

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

Comment on lines +103 to +111
<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>
Copy link
Member

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

Comment on lines +14 to +30
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')}
Copy link
Member

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>
Copy link
Member

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?

@jeffredodd jeffredodd force-pushed the jdj/payroll-localization branch from 367ebd8 to 25ac84a Compare September 10, 2025 18:48
- 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
@jeffredodd jeffredodd force-pushed the jdj/payroll-localization branch from 25ac84a to d1b6c8b Compare September 10, 2025 18:48
@jeffredodd jeffredodd enabled auto-merge (squash) September 10, 2025 18:49
@jeffredodd jeffredodd merged commit d58064e into main Sep 10, 2025
8 checks passed
@jeffredodd jeffredodd deleted the jdj/payroll-localization branch September 10, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants