@localey/svelte 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
# @localey/
|
|
1
|
+
# @localey/svelte
|
|
2
2
|
|
|
3
|
-
Svelte adapter for Localey.
|
|
3
|
+
Svelte template adapter for Localey.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The `@localey/svelte` package enables Localey to process `.svelte` files. It leverages the official Svelte compiler to parse templates and identify hardcoded strings within the Svelte syntax.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Integration Details
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The adapter integrates directly with the Svelte compiler's internal parsing engine. This ensures that it respects the nuances of Svelte's template logic, such as reactive statements and block-based flow control.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
### Extraction Capabilities
|
|
12
|
+
|
|
13
|
+
- **Template Text**: Identifies static text nodes within the HTML portion of the Svelte component.
|
|
14
|
+
- **Element Attributes**: Detects string literals used in element attributes and component props within the template.
|
|
15
|
+
- **Mustache Tags**: Automatically wraps extracted strings in Svelte's mustache syntax (`{t("key")}`) for seamless integration with the Localey runtime.
|
|
16
|
+
|
|
17
|
+
## Component Architecture
|
|
18
|
+
|
|
19
|
+
- **Svelte Compiler API**: Parses the component source into a comprehensive AST.
|
|
20
|
+
- **Template Walker**: Navigates the Svelte-specific AST nodes (MustacheTag, Text, Attribute) to identify localization candidates.
|
|
21
|
+
- **Transformation Layer**: Safely performs string replacements while maintaining the integrity of the component structure.
|