From df1f057f6dbf36a95ff758177cdef5ba76360f6b Mon Sep 17 00:00:00 2001 From: Sahin Vardar Date: Wed, 7 Jun 2023 20:24:01 +0200 Subject: [PATCH] fix: added Checkbox to adjustInputElementLabels --- package.json | 2 +- src/i18n-preprocessor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8202f3d..2796bb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vardario/svelte-i18next", - "version": "0.1.5", + "version": "0.1.6", "description": "", "license": "MIT", "author": "Sahin Vardar", diff --git a/src/i18n-preprocessor.ts b/src/i18n-preprocessor.ts index 62e61f2..13e634d 100644 --- a/src/i18n-preprocessor.ts +++ b/src/i18n-preprocessor.ts @@ -50,7 +50,7 @@ export function adjustI18nCall(ast: Ast, prefix: string, callIdentifier: string export function adjustInputElementLabels(ast: Ast, prefix: string, callIdentifier: string = '$i18n') { compiler.walk(ast.html, { enter: (node: TemplateNode) => { - if (node.type === 'InlineComponent' && node.name === 'Input') { + if (node.type === 'InlineComponent' && ['Input', 'Checkbox'].includes(node.name)) { const nameAttribute = node.attributes?.find((attr: any) => attr.name === 'name'); const labelAttribute = node.attributes?.find((attr: any) => attr.name === 'label');