Skip to content

Commit

Permalink
Extract missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
vesnushka committed Oct 16, 2024
1 parent 49318dc commit e79318b
Show file tree
Hide file tree
Showing 30 changed files with 1,012 additions and 257 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from '@lingui/macro';
import { Form } from 'antd';
import _, { debounce } from 'lodash';
import { useCallback, useContext } from 'react';
Expand All @@ -21,7 +22,7 @@ interface ChoiceQuestionSelectProps {
}

export function ChoiceQuestionSelect(props: ChoiceQuestionSelectProps) {
const { value, onChange, options, repeats = false, placeholder } = props;
const { value, onChange, options, repeats = false, placeholder = t`Select...` } = props;

return (
<>
Expand All @@ -46,7 +47,7 @@ export function QuestionChoice({ parentPath, questionItem }: QuestionItemProps)
const { linkId, answerOption, repeats, answerValueSet } = questionItem;
const fieldName = [...parentPath, linkId];

const { value, formItem, onChange, placeholder } = useFieldController(fieldName, questionItem);
const { value, formItem, onChange, placeholder = t`Select...` } = useFieldController(fieldName, questionItem);

const onSelect = useCallback((option: any) => onChange([].concat(option)), [onChange]);

Expand Down
5 changes: 3 additions & 2 deletions src/components/DashboardCard/creatinine.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { InfoOutlined } from '@ant-design/icons';
import { t } from '@lingui/macro';
import { isSuccess } from 'aidbox-react';
import { Observation, Patient } from 'fhir/r4b';
import moment from 'moment';
Expand Down Expand Up @@ -86,8 +87,8 @@ export function CreatinineDashboard({ observationsRemoteData, patient, reload }:
tickFormatter={formatTime}
/>
<YAxis />
{min > 0 ? <ReferenceLine y={min} label="Min" stroke="red" /> : null}
{max > 0 ? <ReferenceLine y={max} label="Max" stroke="red" /> : null}
{min > 0 ? <ReferenceLine y={min} label={t`Min`} stroke="red" /> : null}
{max > 0 ? <ReferenceLine y={max} label={t`Max`} stroke="red" /> : null}
<Tooltip content={<CustomTooltip />} />
</LineChart>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalNewEncounter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ModalNewEncounter = ({ patient, reloadEncounter }: ModalNewEncounte
reloadEncounter();
setIsModalVisible(false);
notification.success({
message: 'Encounter successfully created',
message: t`Encounter successfully created`,
});
};

Expand Down
31 changes: 20 additions & 11 deletions src/components/QuestionnaireResponseForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from '@lingui/macro';
import { notification } from 'antd';
import { QuestionnaireResponse } from 'fhir/r4b';
import _ from 'lodash';
Expand Down Expand Up @@ -64,7 +65,7 @@ export const saveQuestionnaireResponseDraft = async (
formData.context.questionnaireResponse.id = response.data.id;
}
if (isFailure(response)) {
console.error('Error saving a draft: ', response.error);
console.error(t`Error saving a draft: `, response.error);
}

return response;
Expand All @@ -79,33 +80,41 @@ export function onFormResponse(props: {

if (isSuccess(response)) {
if (response.data.extracted) {

let warnings: string[] = [];
const warnings: string[] = [];
response.data.extractedBundle.forEach((bundle, index) => {
bundle.entry?.forEach((entry, jndex) => {
if (entry.resource.resourceType === "OperationOutcome") {
warnings.push(`Error extrating on ${index}, ${jndex}`);
}
});
if (entry.resource.resourceType === 'OperationOutcome') {
warnings.push(`Error extracting on ${index}, ${jndex}`);
}
});
});
if (warnings.length > 0) {
notification.warning({
message: (<div>{warnings.map((w) => <div key={w}><span>{w}</span><br/></div>)}</div>),
message: (
<div>
{warnings.map((w) => (
<div key={w}>
<span>{w}</span>
<br />
</div>
))}
</div>
),
});
}

if (onSuccess) {
onSuccess(response.data);
} else {
notification.success({
message: 'Form successfully saved',
message: t`Form successfully saved`,
});
}
} else {
if (onFailure) {
onFailure('Error while extracting');
onFailure(t`Error while extracting`);
} else {
notification.error({ message: 'Error while extracting' });
notification.error({ message: t`Error while extracting` });
}
}
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/containers/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from '@lingui/macro';
import queryString from 'query-string';
import { useEffect, useRef } from 'react';
import { Route, BrowserRouter, Routes, Navigate, useLocation, useNavigate } from 'react-router-dom';
Expand Down Expand Up @@ -120,8 +121,8 @@ function AnonymousUserApp() {
path="/thanks"
element={
<NotificationPage
title="Thank you!"
text="Thank you for filling out the questionnaire. Now you can close this page."
title={t`Thank you!`}
text={t`Thank you for filling out the questionnaire. Now you can close this page.`}
/>
}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Appointment/PublicAppointment.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Trans } from '@lingui/macro';
import { t, Trans } from '@lingui/macro';
import { notification } from 'antd';
import { useEffect, useState } from 'react';

Expand Down Expand Up @@ -58,7 +58,7 @@ export function PublicAppointment() {
questionnaireLoader={questionnaireIdLoader('public-appointment')}
onSuccess={() => {
notification.success({
message: 'Appointment successfully created',
message: t`Appointment successfully created`,
});
history.replace('/');
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ChooseDocumentToCreateModal = (props: Props) => {
return (
<>
<Modal
title="Create document"
title={t`Create document`}
footer={[
<Button key="back" onClick={onCloseModal}>
<Trans>Cancel</Trans>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/EncounterDetails/AIScribe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function Extract(props: ExtractProps) {
if (isNotAsked(extractionRD)) {
return (
<ModalTrigger
title="Extract medical documents"
title={t`Extract medical documents`}
trigger={
<Button icon={<PlusOutlined />} type="primary">
<span>
Expand Down
14 changes: 7 additions & 7 deletions src/containers/InvoiceList/tableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ClockCircleOutlined,
ExclamationCircleOutlined,
} from '@ant-design/icons';
import { Trans } from '@lingui/macro';
import { t, Trans } from '@lingui/macro';
import { Tag, Button } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { Invoice, Patient, Practitioner, PractitionerRole } from 'fhir/r4b';
Expand All @@ -24,14 +24,14 @@ import { getPractitionerName, getInvoicePractitioner, getPatientName, getInvoice

export function getInvoiceStatusHumanized(invoice?: Invoice) {
const invoiceStatusMapping = {
balanced: 'Balanced',
cancelled: 'Cancelled',
issued: 'Issued',
draft: 'Draft',
'entered-in-error': 'Entered in error',
balanced: t`Balanced`,
cancelled: t`Cancelled`,
issued: t`Issued`,
draft: t`Draft`,
'entered-in-error': t`Entered in error`,
};

return invoice ? invoiceStatusMapping[invoice.status] : 'unknown';
return invoice ? invoiceStatusMapping[invoice.status] : t`Unknown`;
}

export function InvoiceStatus({ invoice }: { invoice: Invoice }) {
Expand Down
4 changes: 2 additions & 2 deletions src/containers/MedicationManagement/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Trans } from '@lingui/macro';
import { t, Trans } from '@lingui/macro';
import { Typography, Table } from 'antd';
import { MedicationKnowledge } from 'fhir/r4b';

Expand All @@ -25,7 +25,7 @@ export function MedicationManagement() {

return (
<PageContainer
title="Medications"
title={t`Medications`}
titleRightContent={<ModalNewMedicationKnowledge onCreate={pagerManager.reload} />}
headerContent={
<MedicationsSearchBar
Expand Down
15 changes: 8 additions & 7 deletions src/containers/MedicationManagement/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from '@lingui/macro';
import { Descriptions } from 'antd';
import { Medication, MedicationKnowledge } from 'fhir/r4b';
import _ from 'lodash';
Expand Down Expand Up @@ -30,22 +31,22 @@ export function MedicationKnowledgeCharacteristics({
medicationList: Medication[];
}) {
const descriptionItemData = [
{ label: 'Strength', children: <RenderStrength medication={medicationKnowledge} /> },
{ label: 'Packaging', children: medicationKnowledge.packaging?.type?.coding?.[0]?.display },
{ label: 'Amount', children: `${medicationKnowledge.amount?.value} ${medicationKnowledge.amount?.unit}` },
{ label: 'Dose form', children: medicationKnowledge.doseForm?.coding?.[0]?.display },
{ label: t`Strength`, children: <RenderStrength medication={medicationKnowledge} /> },
{ label: t`Packaging`, children: medicationKnowledge.packaging?.type?.coding?.[0]?.display },
{ label: t`Amount`, children: `${medicationKnowledge.amount?.value} ${medicationKnowledge.amount?.unit}` },
{ label: t`Dose form`, children: medicationKnowledge.doseForm?.coding?.[0]?.display },
{
label: 'Cost',
label: t`Cost`,
children: `${medicationKnowledge.cost?.[0]?.cost.value} ${medicationKnowledge.cost?.[0]?.cost.currency}`,
},
{
label: 'Available units',
label: t`Available units`,
children: medicationList.length,
},
];

return (
<Descriptions title="Characteristics" bordered column={{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }}>
<Descriptions title={t`Characteristics`} bordered column={{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }}>
{descriptionItemData.map((descriptionItem) => (
<Descriptions.Item label={descriptionItem.label} key={descriptionItem.label}>
{descriptionItem.children}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from '@lingui/macro';
import { HealthcareService, Practitioner, PractitionerRole } from 'fhir/r4b';

import { RenderRemoteData, formatFHIRDateTime } from '@beda.software/fhir-react';
Expand Down Expand Up @@ -55,7 +56,7 @@ export function NewAppointmentModal(props: NewAppointmentModalProps) {
],
});
return (
<Modal title="New Appointment" open={showModal} footer={null} onCancel={onCancel}>
<Modal title={t`New Appointment`} open={showModal} footer={null} onCancel={onCancel}>
<RenderRemoteData remoteData={response} renderLoading={Spinner}>
{(formData) => {
return (
Expand Down
14 changes: 7 additions & 7 deletions src/containers/PatientDetails/PatientDocumentDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ const amendDocument = async (reload: () => void, qrId?: string) => {
if (isSuccess(response)) {
reload();
notification.success({
message: 'The document successfully amended',
message: t`The document successfully amended`,
});
}
if (isFailure(response)) {
console.error(response.error);
notification.error({
message: 'Error while amending the document',
message: t`Error while amending the document`,
});
}
};
Expand All @@ -96,7 +96,7 @@ function usePatientDocumentDetails(patientId: string) {
}),
);
if (isSuccess(mappedResponse) && !mappedResponse.data.questionnaireResponse) {
return failure(`The document does not exist`);
return failure(t`The document does not exist`);
}
return mappedResponse;
});
Expand Down Expand Up @@ -147,8 +147,8 @@ function PatientDocumentDetailsReadonly(props: {
reload={reload}
qrId={qrId}
title={t`Are you sure you want to amend the document?`}
okText="Yes"
cancelText="No"
okText={t`Yes`}
cancelText={t`No`}
>
<Button className={s.button}>
<Trans>Amend</Trans>
Expand All @@ -172,8 +172,8 @@ function PatientDocumentDetailsReadonly(props: {
action={() => deleteDraft(navigate, patientId, qrId)}
qrId={qrId}
title={t`Are you sure you want to delete the document?`}
okText="Yes"
cancelText="No"
okText={t`Yes`}
cancelText={t`No`}
>
<Button className={s.button} type={'text'} danger>
<Trans>Delete</Trans>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/PatientDetails/PatientHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function PatientHeaderContextProvider(props: React.HTMLAttributes<HTMLDiv
.map(([path, name]) => ({ path, name }))
.value() as BreadCrumb[];

return isRoot ? [...result, { name: 'Overview' }] : result;
return isRoot ? [...result, { name: t`Overview` }] : result;
}, [location?.pathname, breadcrumbsMap, rootPath]);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { t } from '@lingui/macro';
import { Observation, Patient } from 'fhir/r4b';
import _ from 'lodash';

Expand Down Expand Up @@ -27,25 +28,25 @@ export function useGeneralInformationDashboard(patient: Patient) {

const patientDetails = [
{
title: 'Birth date',
title: t`Birth date`,
value: patient.birthDate
? `${formatHumanDate(patient.birthDate)}${getPersonAge(patient.birthDate)}`
: undefined,
},
{
title: 'Sex',
title: t`Sex`,
value: _.upperFirst(patient.gender),
},
{
title: 'BMI',
title: t`BMI`,
value: bmi,
},
{
title: 'Phone number',
title: t`Phone number`,
value: patient.telecom?.filter(({ system }) => system === 'phone')[0]?.value,
},
{
title: 'Email',
title: t`Email`,
value: patient.telecom?.filter(({ system }) => system === 'email')[0]?.value,
},
{
Expand Down
Loading

0 comments on commit e79318b

Please sign in to comment.