Skip to content

Commit

Permalink
Merge pull request #9 from vardario/sahin/fix-extractKeyPathFromFile
Browse files Browse the repository at this point in the history
fix: extractKeyPathFromFile
  • Loading branch information
sahinvardar authored Jun 9, 2023
2 parents faf348c + 6d6c318 commit 5ef8d42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vardario/svelte-i18next",
"version": "0.1.8",
"version": "0.1.9",
"description": "",
"license": "MIT",
"author": "Sahin Vardar",
Expand Down
2 changes: 1 addition & 1 deletion src/extract-i18n-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/string-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
}

0 comments on commit 5ef8d42

Please sign in to comment.