diff --git a/frontend/src/lib/utils/i18n.ts b/frontend/src/lib/utils/i18n.ts index 8e555956c2..0edc699e56 100644 --- a/frontend/src/lib/utils/i18n.ts +++ b/frontend/src/lib/utils/i18n.ts @@ -11,9 +11,11 @@ export function unsafeTranslate(key: string, params = {}, options = {}): string if (Object.hasOwn(m, key)) { return m[key](params, options); } - let res = key.match('^([^:]+):([^:]+)$'); - if (res) { - return (Object.hasOwn(m, res[1]) ? m[res[1]](params, options) : res[1]) + ':' + res[2]; + if (typeof key === 'string' && key) { + let res = key.match('^([^:]+):([^:]+)$'); + if (res) { + return (Object.hasOwn(m, res[1]) ? m[res[1]](params, options) : res[1]) + ':' + res[2]; + } } if (Object.hasOwn(m, toCamelCase(key))) { return m[toCamelCase(key)](params, options);