Skip to content

Commit

Permalink
(chore) Transifix migration for translations
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Jan 17, 2025
1 parent 8dfc44f commit 5aaeeea
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 217 deletions.
3 changes: 2 additions & 1 deletion src/components/sidebar/sidebar.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ interface PageLinkProps {
}

function PageLink({ page, currentActivePage, pagesWithErrors, requestPage }: PageLinkProps) {
const { t } = useTranslation();
const isActive = page.id === currentActivePage;
const hasError = pagesWithErrors.includes(page.id);
return (
Expand All @@ -98,7 +99,7 @@ function PageLink({ page, currentActivePage, pagesWithErrors, requestPage }: Pag
e.preventDefault();
requestPage(page.id);
}}>
<span>{page.label}</span>
<span>{t(page.label)}</span>
</button>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/form-engine.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSession, type Visit } from '@openmrs/esm-framework';
import { FormFactoryProvider } from './provider/form-factory-provider';
import { init, teardown } from './lifecycle';
import { isEmpty, useFormJson } from '.';
import { moduleName } from './globals';
import { formEngineAppName } from './globals';
import { reportError } from './utils/error-utils';
import { useFormCollapse } from './hooks/useFormCollapse';
import { useFormWorkspaceSize } from './hooks/useFormWorkspaceSize';
Expand Down Expand Up @@ -200,7 +200,7 @@ const FormEngine = ({

function I18FormEngine(props: FormEngineProps) {
return (
<I18nextProvider i18n={window.i18next} defaultNS={moduleName}>
<I18nextProvider i18n={window.i18next} defaultNS={formEngineAppName}>
<FormEngine {...props} />
</I18nextProvider>
);
Expand Down
1 change: 1 addition & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const moduleName = '@openmrs/esm-form-engine-lib';
export const formEngineAppName = '@openmrs/esm-form-engine-app';
3 changes: 0 additions & 3 deletions src/lifecycle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { pageObserver } from './components/sidebar/page-observer';
import setupFormEngineLibI18n from './setupI18n';
import { type FormFieldValueAdapter } from './types';

const formFieldAdapters = new Set<FormFieldValueAdapter>();
Expand All @@ -15,8 +14,6 @@ export function registerFormFieldAdaptersForCleanUp(formFieldAdaptersMap: Record
* Invoked on mounting the "FormEngine" component
*/
export function init() {
// Setting up the i18n for the form engine library
setupFormEngineLibI18n();
}

/**
Expand Down
16 changes: 0 additions & 16 deletions src/setupI18n.ts

This file was deleted.

40 changes: 0 additions & 40 deletions translations/ar.json

This file was deleted.

40 changes: 0 additions & 40 deletions translations/en.json

This file was deleted.

38 changes: 0 additions & 38 deletions translations/es.json

This file was deleted.

38 changes: 0 additions & 38 deletions translations/fr.json

This file was deleted.

38 changes: 0 additions & 38 deletions translations/km.json

This file was deleted.

6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
"__mocks__": ["./__mocks__"]
}
},
"include": ["src/**/*", "./setupTests.ts"]
"include": [
"src/**/*",
"./setupTests.ts",
"tools/**/*"
]
}

0 comments on commit 5aaeeea

Please sign in to comment.