Skip to content
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

Added translations for home page #8461

Merged
merged 11 commits into from
Sep 3, 2024
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Facility Creation", () => {
const totalOccupancy = "10";
const doctorCapacity = "5";
const totalDoctor = "10";
const facilityName = "cypress facility";
const facilityName = "Cypress Facility";
const facilityName2 = "Dummy Facility 40";
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
Expand Down
57 changes: 30 additions & 27 deletions src/Components/Facility/FacilityHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
onResponse: ({ res }) => {
if (res?.ok) {
Notification.Success({
msg: "Facility deleted successfully",
msg: t("deleted_successfuly", { name: facilityData?.name }),
nihal467 marked this conversation as resolved.
Show resolved Hide resolved
});
}
navigate("/facility");
Expand Down Expand Up @@ -150,11 +150,10 @@ export const FacilityHome = ({ facilityId }: Props) => {
backUrl="/facility"
>
<ConfirmDialog
title={`Delete ${facilityData?.name}`}
title={t("delete_item", { name: facilityData?.name })}
description={
<span>
Are you sure you want to delete{" "}
<strong>{facilityData?.name}</strong>
{t("are_you_sure_want_to_delete", { name: facilityData?.name })}
</span>
}
action="Delete"
Expand Down Expand Up @@ -247,7 +246,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
</div>
<div className="mb-4" id="address-details-view">
<h1 className="text-base font-semibold text-[#B9B9B9]">
Address
{t("address")}
</h1>
<p className="text-base font-medium">
{facilityData?.address}
Expand All @@ -257,7 +256,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
<div className="flex-col md:flex lg:flex-1">
<div className="mb-4">
<h1 className="text-base font-semibold text-[#B9B9B9]">
Local Body
{t("local_body")}
</h1>
<p className="w-2/3 text-base font-medium md:w-full">
{facilityData?.local_body_object?.name}
Expand All @@ -266,7 +265,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
<div className="mb-4 flex flex-col flex-wrap gap-4 md:flex-row">
<div>
<h1 className="text-base font-semibold text-[#B9B9B9]">
Ward
{t("ward")}
</h1>
<p className="text-base font-medium">
{facilityData?.ward_object?.number +
Expand All @@ -276,7 +275,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
</div>
<div>
<h1 className="text-base font-semibold text-[#B9B9B9]">
District
{t("district")}
</h1>
<p className="text-base font-medium">
{facilityData?.district_object?.name}
Expand All @@ -286,7 +285,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
<div className="flex items-center gap-3">
<div id="phone-number-view">
<h1 className="text-base font-semibold text-[#B9B9B9]">
Phone Number
{t("phone_number")}
</h1>
<ContactLink
tel={String(facilityData?.phone_number)}
Expand All @@ -304,7 +303,9 @@ export const FacilityHome = ({ facilityId }: Props) => {
{facilityData?.features?.some((feature) =>
FACILITY_FEATURE_TYPES.some((f) => f.id === feature),
) && (
<h1 className="text-lg font-semibold">Available features</h1>
<h1 className="text-lg font-semibold">
{t("available_features")}
</h1>
)}
<div
className="mt-5 flex flex-wrap gap-2"
Expand Down Expand Up @@ -346,22 +347,22 @@ export const FacilityHome = ({ facilityId }: Props) => {
authorizeFor={NonReadOnlyUsers}
icon={<CareIcon icon="l-edit-alt" className="text-lg" />}
>
Update Facility
{t("update_facility")}
</DropdownItem>
<DropdownItem
id="configure-facility"
onClick={() => navigate(`/facility/${facilityId}/configure`)}
authorizeFor={NonReadOnlyUsers}
icon={<CareIcon icon="l-setting" className="text-lg" />}
>
Configure Facility
{t("configure_facility")}
</DropdownItem>
<DropdownItem
id="inventory-management"
onClick={() => navigate(`/facility/${facilityId}/inventory`)}
icon={<CareIcon icon="l-clipboard-alt" className="w-5" />}
>
Inventory Management
{t("inventory_management")}
</DropdownItem>
<DropdownItem
id="location-management"
Expand All @@ -371,7 +372,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
<CareIcon icon="l-location-point" className="text-lg" />
}
>
Location Management
{t("location_management")}
</DropdownItem>
<DropdownItem
id="resource-request"
Expand All @@ -381,36 +382,36 @@ export const FacilityHome = ({ facilityId }: Props) => {
authorizeFor={NonReadOnlyUsers}
icon={<CareIcon icon="l-gold" className="text-lg" />}
>
Resource Request
{t("resource_request")}
</DropdownItem>
<DropdownItem
id="create-assets"
onClick={() => navigate(`/facility/${facilityId}/assets/new`)}
authorizeFor={NonReadOnlyUsers}
icon={<CareIcon icon="l-plus-circle" className="text-lg" />}
>
Create Asset
{t("create_asset")}
</DropdownItem>
<DropdownItem
id="view-assets"
onClick={() => navigate(`/assets?facility=${facilityId}`)}
icon={<CareIcon icon="l-medkit" className="text-lg" />}
>
View Assets
{t("view_asset")}
</DropdownItem>
<DropdownItem
id="view-users"
onClick={() => navigate(`/facility/${facilityId}/users`)}
icon={<CareIcon icon="l-users-alt" className="text-lg" />}
>
View Users
{t("view_users")}
</DropdownItem>
<DropdownItem
id="view-abdm-records"
onClick={() => navigate(`/facility/${facilityId}/abdm`)}
icon={<CareIcon icon="l-file-network" className="text-lg" />}
>
View ABDM Records
{t("view_abdm_records")}
</DropdownItem>
{hasPermissionToDeleteFacility ? (
<DropdownItem
Expand All @@ -420,7 +421,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
className="flex items-center gap-3"
icon={<CareIcon icon="l-trash-alt" className="text-lg" />}
>
Delete Facility
{t("delete_facility")}
</DropdownItem>
) : (
<></>
Expand All @@ -437,7 +438,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
onClick={() => navigate(`/facility/${facilityId}/cns`)}
>
<CareIcon icon="l-monitor-heart-rate" className="text-lg" />
<span>Central Nursing Station</span>
<span>{t("central_nursing_station")}</span>
</ButtonV2>
{CameraFeedPermittedUserTypes.includes(authUser.user_type) && (
<LiveMonitoringButton />
Expand All @@ -451,7 +452,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
authorizeFor={NonReadOnlyUsers}
>
<CareIcon icon="l-plus" className="text-lg" />
<span className="text-sm">Add Details of a Patient</span>
<span className="text-sm">{t("add_details_of_patient")}</span>
</ButtonV2>
<ButtonV2
id="view-patient-facility-list"
Expand All @@ -462,7 +463,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
onClick={() => navigate(`/patients?facility=${facilityId}`)}
>
<CareIcon icon="l-user-injured" className="text-lg" />
<span>View Patients</span>
<span>{t("view_patients")}</span>
</ButtonV2>
</div>
</div>
Expand All @@ -472,7 +473,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
<FacilityStaffList facilityId={facilityId} />

<div className="mt-5 rounded bg-white p-3 shadow-sm md:p-6">
<h1 className="mb-6 text-xl font-bold">Oxygen Information</h1>
<h1 className="mb-6 text-xl font-bold">{t("oxygen_information")}</h1>
<div
className="overflow-x-auto overflow-y-hidden"
id="facility-oxygen-info"
Expand Down Expand Up @@ -517,6 +518,8 @@ const LiveMonitoringButton = () => {
const facilityId = useSlug("facility");
const [location, setLocation] = useState<string>();

const { t } = useTranslation();

return (
<Popover className="relative">
<PopoverButton className="mt-2 w-full">
Expand All @@ -528,7 +531,7 @@ const LiveMonitoringButton = () => {
id="facility-detailspage-livemonitoring"
>
<CareIcon icon="l-video" className="text-lg" />
<span>Live Monitoring</span>
<span>{t("live_monitoring")}</span>
</ButtonV2>
</PopoverButton>

Expand All @@ -545,7 +548,7 @@ const LiveMonitoringButton = () => {
<div className="relative flex flex-col gap-4 rounded-b-lg bg-white p-6">
<div>
<FieldLabel htmlFor="location" className="text-sm">
Choose a location
{t("choose_location")}
</FieldLabel>
<div className="flex w-full items-center gap-2">
<LocationSelect
Expand All @@ -567,7 +570,7 @@ const LiveMonitoringButton = () => {
className="w-full"
href={`/facility/${facilityId}/live-monitoring?location=${location}`}
>
Open Live Monitoring
{t("open_live_monitoring")}
</ButtonV2>
</div>
</div>
Expand Down
8 changes: 6 additions & 2 deletions src/Locale/en/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,9 @@
"live": "Live",
"discharged": "Discharged",
"archived": "Archived",
"no_changes_made": "No changes made"
}
"no_changes_made": "No changes made",
"are_you_sure_want_to_delete": "Are you sure you want to delete {{name}}?",
"oxygen_information": "Oxygen Information",
nihal467 marked this conversation as resolved.
Show resolved Hide resolved
"deleted_successfuly": "{{name}} Deleted Successfuly",
"delete_item": "Delete {{name}}"
}
19 changes: 17 additions & 2 deletions src/Locale/en/Facility.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,20 @@
"duplicate_patient_record_rejection": "I confirm that the suspect / patient I want to create is not on the list.",
"duplicate_patient_record_birth_unknown": "Please contact your district care coordinator, the shifting facility or the patient themselves if you are not sure about the patient's year of birth.",
"patient_transfer_birth_match_note": "Note: Year of birth must match the patient to process the transfer request.",
"cover_image_updated_note": "It could take a while to see the updated cover image"
}
"cover_image_updated_note": "It could take a while to see the updated cover image",
"available_features": "Available Features",
"update_facility": "Update Facility",
"configure_facility": "Configure Facility",
"inventory_management": "Inventory Management",
"location_management": "Location Management",
"resource_request": "Resource Request",
"view_asset": "View Assets",
"view_users": "View Users",
"view_abdm_records": "View ABDM Records",
"delete_facility": "Delete Facility",
"central_nursing_station": "Central Nursing Station",
"add_details_of_patient": "Add Details of Patient",
"choose_location": "Choose Location",
"live_monitoring": "Live Monitoring",
"open_live_monitoring": "Open Live Monitoring"
}
Loading