Skip to content

Commit

Permalink
(fix) O3-4253: Add missing translations support in the app (#107)
Browse files Browse the repository at this point in the history
* Add missing translations support in the app

* Update the translation for 'Referred tests'
  • Loading branch information
vasharma05 authored Dec 13, 2024
1 parent b7ee40d commit 2fb2e89
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"typescript": "tsc",
"test": "jest --config jest.config.js --passWithNoTests --color",
"verify": "turbo lint typescript test --color",
"extract-translations": "i18next 'src/**/*.component.tsx' --config ./i18next-parser.config.js",
"extract-translations": "i18next 'src/**/*.component.tsx' 'src/index.ts' --config ./i18next-parser.config.js",
"coverage": "yarn test -- --coverage",
"postinstall": "husky install"
},
Expand Down
4 changes: 3 additions & 1 deletion src/components/create-dashboard-link.component.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useMemo } from 'react';
import { ConfigurableLink } from '@openmrs/esm-framework';
import { BrowserRouter, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';

export interface DashboardLinkConfig {
name: string;
Expand All @@ -9,6 +10,7 @@ export interface DashboardLinkConfig {
}

function DashboardExtension({ dashboardLinkConfig }: { dashboardLinkConfig: DashboardLinkConfig }) {
const { t } = useTranslation();
const { name, title } = dashboardLinkConfig;
const location = useLocation();
const spaBasePath = `${window.spaBase}/home`;
Expand All @@ -24,7 +26,7 @@ function DashboardExtension({ dashboardLinkConfig }: { dashboardLinkConfig: Dash
to={`${spaBasePath}/${name}`}
className={`cds--side-nav__link ${navLink.match(name) && 'active-left-nav-link'}`}
>
{title}
{t(title)}
</ConfigurableLink>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { formatDate, parseDate, usePagination } from '@openmrs/esm-framework';
import { type Order } from '@openmrs/esm-patient-common-lib';
import { useLabOrders, useSearchGroupedResults } from '../../laboratory-resource';
import type { FulfillerStatus, OrdersDataTableProps } from '../../types';
import { OrdersDateRangePicker } from './orders-date-range-picker';
import { OrdersDateRangePicker } from './orders-date-range-picker.component';
import ListOrderDetails from './list-order-details.component';
import styles from './orders-data-table.scss';

Expand Down
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const importTranslation = require.context('../translations', false, /.jso
export const root = getSyncLifecycle(rootComponent, options);

export const laboratoryDashboardLink = getSyncLifecycle(
// t('Laboratory', 'Laboratory')
createHomeDashboardLink({
name: 'laboratory',
slot: 'laboratory-dashboard-slot',
Expand All @@ -36,32 +37,37 @@ export const rejectLabRequestModal = getAsyncLifecycle(
);

// Tables and tiles

// t('Tests ordered', 'Tests ordered')
export const allLabRequestsTable = getAsyncLifecycle(
() => import('./lab-tabs/data-table-extensions/tests-ordered-table.extension'),
options,
);

// t('In progress', 'In progress')
export const inprogressLabRequestsTable = getAsyncLifecycle(
() => import('./lab-tabs/data-table-extensions/in-progress-lab-requests-table.extension'),
options,
);

// t('Completed', 'Completed')
export const completedLabRequestsTable = getAsyncLifecycle(
() => import('./lab-tabs/data-table-extensions/completed-lab-requests-table.extension'),
options,
);

// t('Worklist', 'Worklist')
export const worklistTile = getAsyncLifecycle(
() => import('./lab-tiles/in-progress-lab-requests-tile.component'),
options,
);

// t("Referred tests", "Referred tests")
export const completedTile = getAsyncLifecycle(
() => import('./lab-tiles/completed-lab-requests-tile.component'),
options,
);

// t('Ordered tests', 'Ordered tests')
export const testOrderedTile = getAsyncLifecycle(() => import('./lab-tiles/all-lab-requests-tile.component'), options);

// Actions
Expand Down
2 changes: 1 addition & 1 deletion src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"component": "completedTile",
"meta": {
"name": "referredPanleSlot",
"title": "Referred Tests"
"title": "Referred tests"
}
},
{
Expand Down
10 changes: 9 additions & 1 deletion translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"cancel": "Cancel",
"checkFilters": "Please check the filters above and try again",
"completed": "Completed",
"Completed": "Completed",
"completedStatus": "COMPLETED",
"dateRange": "Date range",
"declinedStatus": "DECLINED",
"discard": "Discard",
"editResults": "Edit results",
Expand All @@ -14,16 +16,19 @@
"exceptionStatus": "EXCEPTION",
"filterOrdersByStatus": "Filter orders by status",
"fulfillerComment": "Fulfiller comment",
"In progress": "In progress",
"inProgress": "In progress",
"inProgressStatus": "IN_PROGRESS",
"laboratory": "Laboratory",
"Laboratory": "Laboratory",
"loading": "Loading",
"newStatus": "NEW",
"nextPage": "Next page",
"NoInstructionLeft": "No instructions are provided.",
"noLabRequestsFoundC": "No lab requests found",
"onHoldStatus": "ON_HOLD",
"orderDate": "Order Date:",
"Ordered tests": "Ordered tests",
"ordererName": "Orderer Name: ",
"orderInStruction": "Instructions: ",
"orderNotPicked": "Order not picked",
Expand All @@ -39,6 +44,7 @@
"pickupLabRequest": "Pick up lab request",
"previousPage": "Previous page",
"receivedStatus": "RECEIVED",
"Referred tests": "Referred tests",
"reject": "Reject",
"rejectLabRequest": "Reject lab request",
"rejectLabRequestSuccessMessage": "",
Expand All @@ -47,10 +53,12 @@
"searchThisList": "Search this list",
"tabletOverlay": "Tablet overlay",
"testOrdered": "Test ordered: ",
"Tests ordered": "Tests ordered",
"testsOrdered": "Tests ordered",
"testType": "Test type",
"totalOrders": "Total orders",
"urgencyStatus": "Urgency: ",
"viewTestResults": "View test results",
"worklist": "Worklist"
"worklist": "Worklist",
"Worklist": "Worklist"
}

0 comments on commit 2fb2e89

Please sign in to comment.