diff --git a/package.json b/package.json index 07d1dec..86a3383 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vardario/svelte-i18next", - "version": "0.1.8", + "version": "0.1.9", "description": "", "license": "MIT", "author": "Sahin Vardar", diff --git a/src/extract-i18n-keys.ts b/src/extract-i18n-keys.ts index 4839c7f..4a4dc38 100644 --- a/src/extract-i18n-keys.ts +++ b/src/extract-i18n-keys.ts @@ -49,7 +49,7 @@ export async function processSvelteFile( const addKeyPath = (key: string) => { const path = extractKeyPathFromFile(filename); - return `${path}.${key}`.replace(/\[|\]/g, ''); + return `${path}.${key}`; }; return keys.map(addKeyPath); diff --git a/src/string-utils.ts b/src/string-utils.ts index ea1ce47..6391712 100644 --- a/src/string-utils.ts +++ b/src/string-utils.ts @@ -23,5 +23,5 @@ export function extractKeyPathFromFile(filename: string) { const index = pathParts.findIndex(pathPart => regEx.exec(pathPart)); const result = pathParts.slice(index).join('.'); - return result.replace('.svelte', '').replace('+', ''); + return result.replace('.svelte', '').replace('+', '').replace(/\[|\]/g, ''); }