Skip to content

Commit f5ce9b0

Browse files
committed
move localeOverrides to use trycatch
1 parent 9293fb6 commit f5ce9b0

File tree

1 file changed

+7
-3
lines changed
  • plugin-hrm-form/src/translations

1 file changed

+7
-3
lines changed

plugin-hrm-form/src/translations/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ export const loadTranslations = async (language: string): Promise<Record<string,
107107
console.error(`Base language file not found for ${baseLanguage}`);
108108
}
109109

110-
if (language !== baseLanguage) {
111-
const localeOverrides = require(`./locales/${language}.json`);
112-
translations = { ...translations, ...localeOverrides };
110+
try {
111+
if (language !== baseLanguage) {
112+
const localeOverrides = require(`./locales/${language}.json`);
113+
translations = { ...translations, ...localeOverrides };
114+
}
115+
} catch (error) {
116+
console.error(`Locale file not found for ${language}`);
113117
}
114118

115119
const definitionVersion = getDefinitionVersions().currentDefinitionVersion;

0 commit comments

Comments
 (0)