fix(i18n): use singular mail label counts in English and Bokmal
This commit is contained in:
@@ -118,6 +118,23 @@ function renderPage(initialPath = '/') {
|
||||
}
|
||||
|
||||
describe('CorrespondenceInboxPage', () => {
|
||||
test.each(['en', 'nb'] as const)('%s label counts keep singular/plural grammar through a live locale change', async language => {
|
||||
const original = mockedApi.get.getMockImplementation();
|
||||
mockedApi.get.mockImplementation((url: string, config?: any) => url === '/correspondence/page'
|
||||
? Promise.resolve({ data: pageData([messageItem({ subject: 'One label', labelCount: 1 }), messageItem({ id: 2, subject: 'Two labels', labelCount: 2 })]) } as any)
|
||||
: original!(url, config));
|
||||
localStorage.setItem('uiLanguage', language); renderPage();
|
||||
await screen.findByRole('article', { name: 'One label' });
|
||||
const reads = mockedApi.get.mock.calls.length;
|
||||
const assertLabels = (locale: UiLanguage) => {
|
||||
expect(messageRow('One label').getByText(locale === 'en' ? '1 label' : '1 etikett', { exact: true })).toBeVisible();
|
||||
expect(messageRow('Two labels').getByText(locale === 'en' ? '2 labels' : '2 etiketter', { exact: true })).toBeVisible();
|
||||
};
|
||||
assertLabels(language);
|
||||
const other = language === 'en' ? 'nb' : 'en'; await changeLanguage(other); assertLabels(other);
|
||||
expect(mockedApi.get).toHaveBeenCalledTimes(reads);
|
||||
expect(mockedApi.post).not.toHaveBeenCalled(); expect(mockedApi.put).not.toHaveBeenCalled(); expect(mockedApi.delete).not.toHaveBeenCalled();
|
||||
});
|
||||
test.each(['en', 'nb'] as const)('%s opened message retains one application action in named context', async language => {
|
||||
localStorage.setItem('uiLanguage', language); renderPage();
|
||||
await screen.findByText('Interview invite', { exact: true });
|
||||
|
||||
@@ -453,6 +453,7 @@ export const translations = {
|
||||
emailInboxUnknownRole: "Unknown role",
|
||||
emailInboxThreadId: "Thread {id}",
|
||||
emailInboxManualInternal: "Manual/internal",
|
||||
emailInboxLabelCount: "{count} label",
|
||||
emailInboxLabels: "{count} labels",
|
||||
emailInboxAttachments: "{count} attachments",
|
||||
emailInboxHideMessage: "Hide message",
|
||||
@@ -3669,6 +3670,7 @@ export const translations = {
|
||||
emailInboxUnknownRole: "Ukjent rolle",
|
||||
emailInboxThreadId: "Tråd {id}",
|
||||
emailInboxManualInternal: "Manuell/intern",
|
||||
emailInboxLabelCount: "{count} etikett",
|
||||
emailInboxLabels: "{count} etiketter",
|
||||
emailInboxAttachments: "{count} vedlegg",
|
||||
emailInboxHideMessage: "Skjul melding",
|
||||
|
||||
@@ -842,7 +842,7 @@ export default function CorrespondenceInboxPage() {
|
||||
{item.direction ? <Chip size="small" label={t(item.direction === "inbound" ? "emailInboxInbound" : item.direction === "outbound" ? "emailInboxOutbound" : "emailInboxInternal")} variant="outlined" /> : null}
|
||||
{item.provider ? <Chip size="small" label={item.provider === "microsoft" ? "Outlook" : item.provider === "gmail" ? "Gmail" : item.provider.toUpperCase()} variant="outlined" /> : null}
|
||||
{item.externalThreadId ? <Chip size="small" label={t("emailInboxThreadId", { id: item.externalThreadId })} color="success" variant="outlined" /> : <Chip size="small" label={t("emailInboxManualInternal")} variant="outlined" />}
|
||||
{item.labelCount > 0 ? <Chip size="small" label={t("emailInboxLabels", { count: item.labelCount })} variant="outlined" /> : null}
|
||||
{item.labelCount > 0 ? <Chip size="small" label={item.labelCount === 1 ? t("emailInboxLabelCount", { count: item.labelCount }) : t("emailInboxLabels", { count: item.labelCount })} variant="outlined" /> : null}
|
||||
{item.attachmentCount > 0 ? <Chip size="small" label={t(item.attachmentCount === 1 ? "emailInboxAttachmentCount" : "emailInboxAttachments", { count: item.attachmentCount })} variant="outlined" /> : null}
|
||||
<Button size="small" variant="text" disabled={!!unlinkingThreadId} aria-expanded={selectedMessageId === item.id} aria-controls={selectedMessageId === item.id ? `${rowId}-${item.id}-message` : undefined} onClick={() => void showMessage(item)}>{selectedMessageId === item.id ? t("emailInboxHideMessage") : t("emailInboxViewMessage")}</Button>
|
||||
{selectedMessageId !== item.id ? <Button size="small" variant="text" disabled={!!unlinkingThreadId} onClick={() => navigate(`/jobs/${item.jobApplicationId}?section=communication`, { state: { from: location.pathname + location.search + location.hash } })}>{t("emailInboxOpenJob")}</Button> : null}
|
||||
|
||||
Reference in New Issue
Block a user