Skip to content

Commit

Permalink
Added translation for Home breadcrumb and left nav link
Browse files Browse the repository at this point in the history
  • Loading branch information
vasharma05 committed Sep 27, 2023
1 parent 5664938 commit c0b306d
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ dist
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# i18next parser creating moduleName folder when parsing index.ts
moduleName
2 changes: 1 addition & 1 deletion packages/esm-home-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint": "cross-env TIMING=1 eslint src --ext ts,tsx --fix --max-warnings=0 --color",
"typescript": "tsc",
"verify": "turbo lint typescript test --color",
"extract-translations": "i18next 'src/**/*.{component.tsx,tsx}' --config ../../tools/i18next-parser.config.js",
"extract-translations": "i18next 'src/**/*.{component.tsx,tsx}' 'src/index.ts' --config ../../tools/i18next-parser.config.js",
"test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests",
"coverage": "yarn test --coverage"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { useMemo } from 'react';
import { BrowserRouter, useLocation } from 'react-router-dom';
import { ConfigurableLink } from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';

export interface DashboardLinkConfig {
name: string;
title: string;
}

const DashboardLink = ({ dashboardLinkConfig }: { dashboardLinkConfig: DashboardLinkConfig }) => {
const { t } = useTranslation();
const { name } = dashboardLinkConfig;
const location = useLocation();
const spaBasePath = `${window.spaBase}/home`;
Expand All @@ -23,7 +25,8 @@ const DashboardLink = ({ dashboardLinkConfig }: { dashboardLinkConfig: Dashboard
to={spaBasePath}
className={`cds--side-nav__link ${navLink === 'home' && 'active-left-nav-link'}`}
>
{name}
{/* t('Home', 'Home') */}
{t(name)}
</ConfigurableLink>
);
};
Expand Down
5 changes: 3 additions & 2 deletions packages/esm-home-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { registerBreadcrumbs, defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
import { createDashboardLink } from './createDashboardLink';
import { createDashboardLink } from './createDashboardLink.component';
import { dashboardMeta } from './dashboard.meta';
import { esmHomeSchema } from './openmrs-esm-home-schema';

Expand All @@ -26,11 +26,12 @@ export const homeWidgetDashboard = getAsyncLifecycle(

export function startupApp() {
defineConfigSchema(moduleName, esmHomeSchema);
// t('Home', 'Home');

registerBreadcrumbs([
{
path: `${window.spaBase}/${pageName}`,
title: 'Home',
title: () => Promise.resolve(window.i18next.t('Home', { defaultValue: 'Home', ns: moduleName })),
},
]);
}
3 changes: 3 additions & 0 deletions packages/esm-home-app/translations/am.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Home": "Home"
}
8 changes: 1 addition & 7 deletions packages/esm-home-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{
"activeVisits": "Active Visits",
"appointmentScheduling": "Appointment Scheduling",
"captureVitals": "Capture Vitals",
"configureMetadata": "Configure Metadata",
"dataManagement": "Data Management",
"reports": "Reports",
"systemAdministration": "System Administration"
"Home": "Home"
}
7 changes: 2 additions & 5 deletions packages/esm-home-app/translations/es.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"patient": "paciente",
"found": "encontró",
"containing":"conteniendo",
"patientSearchText": "Búsqueda por nombre de paciente O identificador"
}
"Home": "Home"
}
8 changes: 1 addition & 7 deletions packages/esm-home-app/translations/fr.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{
"activeVisits": "Visites actives",
"appointmentScheduling": "Planification de rendez-vous",
"captureVitals": "Entrer les signes vitaux",
"configureMetadata": "Configurer les métadonnées",
"dataManagement": "Gestion de données",
"reports": "Rapports",
"systemAdministration": "Administration du système"
"Home": "Home"
}
8 changes: 1 addition & 7 deletions packages/esm-home-app/translations/he.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{
"activeVisits": "ביקורים פעילים",
"appointmentScheduling": "תזמון תורים",
"captureVitals": "לכידת נתוני חיים",
"configureMetadata": "הגדרת מטה-נתונים",
"dataManagement": "ניהול נתונים",
"reports": "דוחות",
"systemAdministration": "ניהול מערכת"
"Home": "Home"
}
3 changes: 3 additions & 0 deletions packages/esm-home-app/translations/km.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Home": "ផ្ទះ"
}

0 comments on commit c0b306d

Please sign in to comment.