Skip to content

Commit

Permalink
(fix) Define behaviour for translations from esm-app-shell (openmrs#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher committed Jul 6, 2023
1 parent d14d699 commit e3d6017
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/shell/esm-app-shell/src/locale.ts
Expand Up @@ -42,6 +42,23 @@ export function setupI18n() {
callback(Error("can't handle translation namespace"), null);
} else if (namespace === undefined || language === undefined) {
callback(Error(), null);
} else if (namespace === "@openmrs/esm-app-shell") {
// currently, we don't have translations in the app shell
getConfigInternal(namespace)
.then((config) => {
let translations = {};
if (config && "Translation overrides" in config) {
const overrides = config["Translation overrides"];
if (language in overrides) {
translations = overrides[language];
}
}

callback(null, translations);
})
.catch((err: Error) => {
callback(err, null);
});
} else {
importDynamic(namespace)
.then((module) =>
Expand Down

0 comments on commit e3d6017

Please sign in to comment.