openmrs-esm-core

O3 Framework / getCoreTranslation

Function: getCoreTranslation()

getCoreTranslation(key, defaultText?, options?): string

Defined in: packages/framework/esm-translations/src/index.ts:69

Use this function to obtain a translation from the core translations. This is a way to avoid having to define common translations in your app, and to ensure that translations are consistent across different apps. This function is also used to obtain translations in the framework and app shell.

The complete set of core translations is available on the CoreTranslationKey type. Providing an invalid key to this function will result in a type error.

Parameters

key

The translation key from the set of core translations.

"cancel" "change" "close" "error" "unknown" "state" "Clinic" "abnormalValue" "actions" "actionableNotification" "address" "age" "batchActionItemSelected" "batchActionsItemsSelected" "closesActionableNotification" "closeSnackbar" "confirm" "contactAdministratorIfIssuePersists" "contactDetails" "delete" "discardChanges" "edit" "emptyStateText" "errorCopy" "errorLoadingLoginLocations" "female" "leftNavigation" "loading" "male" "noResultsToDisplay" "notAvailable" "other" "paginationItemsCount" "paginationOfPages" "patientAvatarAlt" "patientIdentifierSticker" "patientLists" "patientPhotoAlt" "patientPhotoPlaceholder" "print" "printError" "printErrorExplainer" "printIdentifierSticker" "printing" "recordNewEntry" "relationships" "resetOverrides" "save" "scriptLoadingFailed" "scriptLoadingError" "searchForLocation" "seeAll" "seeMoreLists" "selectAll" "sex" "showLess" "showMore" "snackbarNotification" "toggleDevTools" "yearAbbreviation" "yearsAbbreviation" "closeWorkspaces2PromptTitle" "closeWorkspaces2PromptBody" "closeAllOpenedWorkspaces" "closingAllWorkspacesPromptBody" "closingAllWorkspacesPromptTitle" "discard" "hide" "maximize" "minimize" "openAnyway" "unsavedChangesInOpenedWorkspace" "unsavedChangesInWorkspace" "unsavedChangesTitleText" "workspaceHeader" "address1" "address2" "address3" "address4" "address5" "address6" "city" "cityVillage" "country" "countyDistrict" "district" "postalCode" "stateProvince"

defaultText?

string

Optional fallback text if the translation is not found.

options?

Omit<TOptions, "ns" | "defaultValue">

Object passed to the i18next t function. See https://www.i18next.com/translation-function/essentials#overview-options for more information. ns and defaultValue are already set and may not be used.

Returns

string

The translated string.