Skip to content

Commit

Permalink
Update i18n.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-intuitem committed Dec 21, 2024
1 parent 1dfce6f commit ae297e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/lib/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ae297e9

Please sign in to comment.