Skip to content

Commit

Permalink
Merge pull request #8 from vardario/sahin/param-path-fix
Browse files Browse the repository at this point in the history
fix: param path keys
  • Loading branch information
sahinvardar authored Jun 9, 2023
2 parents 15fbb6d + 7a6325b commit faf348c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions assets/example/routes/users/[userId]/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<main>
<section>
{$i18n('user-message')}
</section>
</main>
1 change: 1 addition & 0 deletions assets/translations/de.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ routes.layout.header;xxxTODOxxx
routes.page.intro;xxxTODOxxx
routes.page.known-from;xxxTODOxxx
routes.team.page.team-intro;xxxTODOxxx
routes.users.userId.page.user-message;xxxTODOxxx
1 change: 1 addition & 0 deletions assets/translations/en.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ routes.layout.header;xxxTODOxxx
routes.page.intro;xxxTODOxxx
routes.page.known-from;xxxTODOxxx
routes.team.page.team-intro;xxxTODOxxx
routes.users.userId.page.user-message;xxxTODOxxx
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.7",
"version": "0.1.8",
"description": "",
"license": "MIT",
"author": "Sahin Vardar",
Expand Down
3 changes: 2 additions & 1 deletion src/extract-i18n-keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ describe('extract-i18n-keys', () => {
'routes.layout.header',
'routes.page.intro',
'routes.page.known-from',
'routes.team.page.team-intro'
'routes.team.page.team-intro',
'routes.users.userId.page.user-message'
].sort()
);
});
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}`;
return `${path}.${key}`.replace(/\[|\]/g, '');
};

return keys.map(addKeyPath);
Expand Down

0 comments on commit faf348c

Please sign in to comment.