From 3faa18daceb9b361f50452534e14914db6eb5e38 Mon Sep 17 00:00:00 2001 From: Brandon Istenes Date: Wed, 16 Feb 2022 17:44:39 -0800 Subject: [PATCH] (feat) Add options parameter to translateFrom (#329) * (feat) Add options parameter to translateFrom * Fixup --- packages/framework/esm-framework/docs/API.md | 5 +++-- packages/framework/esm-utils/src/translate.ts | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/framework/esm-framework/docs/API.md b/packages/framework/esm-framework/docs/API.md index 0d6a1aaf7..5d4f58a5d 100644 --- a/packages/framework/esm-framework/docs/API.md +++ b/packages/framework/esm-framework/docs/API.md @@ -3977,7 +3977,7 @@ ___ ### translateFrom -▸ **translateFrom**(`moduleName`, `key`, `fallback?`): `string` +▸ **translateFrom**(`moduleName`, `key`, `fallback?`, `options?`): `string` #### Parameters @@ -3986,6 +3986,7 @@ ___ | `moduleName` | `string` | | `key` | `string` | | `fallback?` | `string` | +| `options?` | `object` | #### Returns @@ -4551,7 +4552,7 @@ a route listener is set up to update the patient whenever the route changes. #### Defined in -[packages/framework/esm-react-utils/src/usePatient.ts:86](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-react-utils/src/usePatient.ts#L86) +[packages/framework/esm-react-utils/src/usePatient.ts:91](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-react-utils/src/usePatient.ts#L91) ___ diff --git a/packages/framework/esm-utils/src/translate.ts b/packages/framework/esm-utils/src/translate.ts index fdffe63fd..fa3baef62 100644 --- a/packages/framework/esm-utils/src/translate.ts +++ b/packages/framework/esm-utils/src/translate.ts @@ -3,11 +3,13 @@ import _i18n from "i18next"; export function translateFrom( moduleName: string, key: string, - fallback?: string + fallback?: string, + options?: object ) { const i18n: typeof _i18n = (_i18n as any).default || _i18n; return i18n.t(key, { ns: moduleName, defaultValue: fallback, + ...options, }); }