From d10dad85c6656643d4d6aa5c1a40b612e0a3ce8a Mon Sep 17 00:00:00 2001 From: MohammadAboulEla <89942942+MohammadAboulEla@users.noreply.github.com> Date: Fri, 7 Mar 2025 22:06:26 +0200 Subject: [PATCH] Update formatUtil.ts (#2906) Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com> --- src/utils/formatUtil.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/formatUtil.ts b/src/utils/formatUtil.ts index e9e7b6f4f..624a1bf6b 100644 --- a/src/utils/formatUtil.ts +++ b/src/utils/formatUtil.ts @@ -135,7 +135,7 @@ export function getPathDetails(path: string) { * Replaces dots with underscores. */ export function normalizeI18nKey(key: string) { - return key.replace(/\./g, '_') + return typeof key === 'string' ? key.replace(/\./g, '_') : '' } /** @@ -232,7 +232,9 @@ export function createAnnotatedPath( const { rootFolder = 'input', subfolder } = options if (typeof item === 'string') return `${createPath(item, subfolder)}${createAnnotation(item, rootFolder)}` - return `${createPath(item.filename ?? '', item.subfolder)}${item.type ? createAnnotation(item.type, rootFolder) : ''}` + return `${createPath(item.filename ?? '', item.subfolder)}${ + item.type ? createAnnotation(item.type, rootFolder) : '' + }` } /**