Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Internationalization (i18n) is the process of designing software applications to be adapted easily for different languages and regions without requiring significant engineering changes. The goal of internationalization is to make the application locale-aware, meaning that it can be easily adapted to different locales or regions without requiring any changes to the codebase. We

In OpenMRS v3, we use react-i18next to internationalize frontend module content.

In order to internationalize your frontend module, add this line in the index.ts file to tell the app shell where to find the translation files.

...

Code Block
languagets
import { getCoreTranslation } from "@openmrs/esm-framework";
 
const ErrorHeader = () => {
  return <h4>{getCoreTranslation("error", "Error")}</h4>;
};
Info

The Value of using the t Function: When working on O3 apps for the community Reference Application, using the t function is a key requirement to ensure your code strings will be included in our community Translation tool, Transifex.

For more about translation, see: How to Translate OpenMRS.