locadex 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.
Files changed (71) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +14 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/fixErrors.d.ts +4 -0
  7. package/dist/commands/fixErrors.d.ts.map +1 -0
  8. package/dist/commands/fixErrors.js +41 -0
  9. package/dist/commands/fixErrors.js.map +1 -0
  10. package/dist/logging/logger.d.ts.map +1 -1
  11. package/dist/logging/logger.js.map +1 -1
  12. package/dist/mcp/getGuide.d.ts.map +1 -1
  13. package/dist/mcp/getGuide.js +2 -1
  14. package/dist/mcp/getGuide.js.map +1 -1
  15. package/dist/mcp/tools/guides.d.ts.map +1 -1
  16. package/dist/mcp/tools/guides.js +25 -55
  17. package/dist/mcp/tools/guides.js.map +1 -1
  18. package/dist/mcp.d.ts.map +1 -1
  19. package/dist/mcp.js +4 -2
  20. package/dist/mcp.js.map +1 -1
  21. package/dist/tasks/concurrency.d.ts.map +1 -1
  22. package/dist/tasks/concurrency.js +15 -23
  23. package/dist/tasks/concurrency.js.map +1 -1
  24. package/dist/tasks/fixErrors.d.ts +2 -0
  25. package/dist/tasks/fixErrors.d.ts.map +1 -0
  26. package/dist/tasks/fixErrors.js +82 -0
  27. package/dist/tasks/fixErrors.js.map +1 -0
  28. package/dist/tasks/i18n.d.ts.map +1 -1
  29. package/dist/tasks/i18n.js +25 -82
  30. package/dist/tasks/i18n.js.map +1 -1
  31. package/dist/tasks/setup.d.ts.map +1 -1
  32. package/dist/tasks/setup.js +21 -9
  33. package/dist/tasks/setup.js.map +1 -1
  34. package/dist/types/claude-sdk.d.ts +13 -9
  35. package/dist/types/claude-sdk.d.ts.map +1 -1
  36. package/dist/types/claude-sdk.js.map +1 -1
  37. package/dist/utils/claudeCode.d.ts +13 -1
  38. package/dist/utils/claudeCode.d.ts.map +1 -1
  39. package/dist/utils/claudeCode.js +173 -66
  40. package/dist/utils/claudeCode.js.map +1 -1
  41. package/dist/utils/errors.d.ts +20 -0
  42. package/dist/utils/errors.d.ts.map +1 -0
  43. package/dist/utils/errors.js +39 -0
  44. package/dist/utils/errors.js.map +1 -0
  45. package/dist/utils/packages/installPackage.d.ts +1 -2
  46. package/dist/utils/packages/installPackage.d.ts.map +1 -1
  47. package/dist/utils/packages/installPackage.js +19 -28
  48. package/dist/utils/packages/installPackage.js.map +1 -1
  49. package/dist/utils/shared.d.ts +1 -1
  50. package/dist/utils/shared.js +1 -1
  51. package/dist/utils/shared.js.map +1 -1
  52. package/dist/utils/shutdown.d.ts +1 -2
  53. package/dist/utils/shutdown.d.ts.map +1 -1
  54. package/dist/utils/shutdown.js +1 -5
  55. package/dist/utils/shutdown.js.map +1 -1
  56. package/guides/next/advanced/{ternary-operators.md → conditional-rendering.md} +97 -39
  57. package/guides/next/advanced/external-strings.md +346 -0
  58. package/guides/next/advanced/interpolated-strings.md +35 -115
  59. package/guides/next/advanced/{complicated-mapping-expressions.md → mapping-expressions.md} +58 -51
  60. package/guides/next/basic/branches.md +62 -45
  61. package/guides/next/basic/jsx.md +35 -33
  62. package/guides/next/basic/strings.md +43 -25
  63. package/guides/next/basic/variables.md +12 -12
  64. package/guides/next/important/functions.md +13 -11
  65. package/guides/next/{advanced → migration}/migrating.md +2 -3
  66. package/package.json +1 -1
  67. package/guides/next/advanced/var-outside-client-component.md +0 -446
  68. package/guides/next/advanced/var-outside-client-server-component.md +0 -550
  69. package/guides/next/advanced/var-outside-server-component.md +0 -545
  70. package/guides/next/basic/client-side-components.md +0 -221
  71. package/guides/next/basic/server-side-components.md +0 -165
@@ -1,14 +1,13 @@
1
- # Internationalization Patterns for Dynamic Content
1
+ # Guide: Internationalization Patterns for Mapped Content
2
2
 
3
- **Objective**: Implement internationalization for mapping expressions using `<T>`, `useGT()`/`getGT()`, and `useDict()`/`getDict()`.
3
+ **Objective**: Implement internationalization for mapping expressions using `<T>`, `useGT()`, and `useTranslations()`.
4
4
 
5
- ## Core Principles
6
-
7
- ### `<T>` Component Usage
5
+ ## `<T>` Component Usage
8
6
 
9
7
  **Rule**: `<T>` components translate static JSX content only. Dynamic content requires alternative approaches.
10
8
 
11
9
  **Valid pattern**:
10
+
12
11
  ```jsx
13
12
  <T>
14
13
  <div> Here's some translated text </div>
@@ -17,24 +16,32 @@
17
16
  ```
18
17
 
19
18
  **Invalid pattern** - `<T>` cannot process dynamic mapping:
19
+
20
20
  ```jsx
21
21
  const MyComponent = () => {
22
22
  const someList = [
23
- <div>Hello Archie</div>,
24
- <div>Hello Ernest</div>,
25
- <div>Hello Brian</div>,
23
+ <div>Hello, World!</div>,
24
+ <div>Welcome to the website!</div>,
25
+ <div>Goodbye!</div>,
26
26
  ];
27
27
  return <T>{someList.map((item) => item)}</T>; // INVALID
28
28
  };
29
29
  ```
30
30
 
31
31
  **Solution**: Apply `<T>` to individual static items, not the mapping operation:
32
+
32
33
  ```jsx
33
34
  const MyComponent = () => {
34
35
  const someList = [
35
- <T><div>Hello Archie</div></T>,
36
- <T><div>Hello Ernest</div></T>,
37
- <T><div>Hello Brian</div></T>,
36
+ <T>
37
+ <div>Hello, World!</div>
38
+ </T>,
39
+ <T>
40
+ <div>Welcome to the website!</div>
41
+ </T>,
42
+ <T>
43
+ <div>Goodbye!</div>
44
+ </T>,
38
45
  ];
39
46
  return <>{someList.map((item) => item)}</>;
40
47
  };
@@ -42,71 +49,71 @@ const MyComponent = () => {
42
49
 
43
50
  **Key requirement**: Each `<T>` component must have direct access to static text content.
44
51
 
45
- ### String Translation Methods
46
-
47
- #### `useGT()` and `getGT()` Pattern
52
+ ## `useGT()` Pattern
48
53
 
49
54
  **Implementation**: Translate individual strings within data structures before mapping:
50
55
 
51
56
  ```jsx
52
- import { useGT } from "gt-next/client";
53
- import { getGT } from "gt-next/server";
54
-
57
+ import { useGT } from 'gt-next';
55
58
  const MyComponent = () => {
56
- // Client-side: const t = useGT();
57
- // Server-side: const t = await getGT();
58
- const t = useGT(); // or await getGT()
59
-
59
+ const t = useGT();
60
60
  const someList = [
61
- t('Hello Archie'),
62
- t('Hello Ernest'),
63
- t('Hello Brian'),
61
+ t('Hello, World!'),
62
+ t('Welcome to the website!'),
63
+ t('Goodbye!'),
64
64
  ];
65
65
  return <>{someList.map((item) => item)}</>;
66
66
  };
67
67
  ```
68
68
 
69
- #### `useDict()` and `getDict()` Pattern
69
+ **Note:** When a function or component is marked as `async`, you should use the `getGT()` hook to get the translation callback function. `getGT()` must be awaited. Other than this, the usage of `getGT()` and `useGT()` is the same.
70
70
 
71
- **Note**: Dictionary approach separates content from implementation context. Use sparingly - only when content reuse across components justifies the separation.
71
+ **Key requirement**: Each string must be static.
72
+
73
+ ## `useTranslations()` Pattern
74
+
75
+ ### Notes
76
+
77
+ - This is the classic dictionary approach. It separates content from implementation context.
78
+ - **Use sparingly** - only use this approach when content reuse across components justifies the separation.
79
+ - Additionally, this approach may be used to internationalize complex strings that are both logically functional and are also displayed in UI.
72
80
 
73
81
  **Dictionary structure**:
74
- ```json
82
+
83
+ ```json title="dictionary.json"
75
84
  {
76
- "Greetings": {
77
- "Archie": "Archie",
78
- "Ernest": "Ernest",
79
- "Brian": "Brian"
85
+ "greetings": {
86
+ "world": "Hello, World!",
87
+ "welcome": "Welcome to the website!",
88
+ "goodbye": "Goodbye!"
80
89
  }
81
90
  }
82
91
  ```
83
92
 
84
93
  **Implementation**:
85
- ```jsx
86
- import { useDict } from "gt-next/client";
87
- import { getDict } from "gt-next/server";
88
94
 
95
+ ```jsx
96
+ import { useTranslations } from 'gt-next';
89
97
  const MyComponent = () => {
90
- // Client-side: const t = useDict();
91
- // Server-side: const t = await getDict();
92
- const t = useDict(); // or await getDict()
93
-
94
- const someList = [
95
- t('Greetings.Archie'),
96
- t('Greetings.Ernest'),
97
- t('Greetings.Brian'),
98
- ];
99
- return <>{someList.map((item) => item)}</>;
98
+ const t = useTranslations();
99
+ const someListOfIds = ['world', 'welcome', 'goodbye'];
100
+ return <>{someListOfIds.map((id) => t(`greetings.${id}`))}</>;
100
101
  };
101
102
  ```
102
103
 
104
+ ### Notes
105
+
106
+ - Strings, when used with `useTranslations()`, are always accessed dynamically as dictionary keys.
107
+ - When a function or component is marked as `async`, you should use the `getTranslations()` hook to get the translation callback function. `getTranslations()` must be awaited. Other than this, the usage of `getTranslations()` and `useTranslations()` is the same.
108
+
103
109
  ## Complex Nested Object Translation
104
110
 
105
111
  ### Challenge: Multi-level Data Structures
106
112
 
107
- **Scenario**: Nested objects with translatable content at multiple levels require systematic translation approach.
113
+ **Scenario**: This is an example scenario where nested objects with translatable content at multiple levels require a systematic translation approach.
108
114
 
109
115
  **Non-internationalized example**:
116
+
110
117
  ```jsx
111
118
  const MyComponent = () => {
112
119
  const users = {
@@ -116,17 +123,16 @@ const MyComponent = () => {
116
123
  skills: ['JavaScript', 'React', 'TypeScript'],
117
124
  },
118
125
  ernest: {
119
- name: 'Ernest',
126
+ name: 'Ernest',
120
127
  role: 'Designer',
121
128
  skills: ['UI/UX', 'Figma', 'Illustration'],
122
129
  },
123
130
  brian: {
124
131
  name: 'Brian',
125
- role: 'Product Manager',
132
+ role: 'Product Manager',
126
133
  skills: ['Strategy', 'Planning', 'Communication'],
127
134
  },
128
135
  };
129
-
130
136
  return (
131
137
  <div>
132
138
  {Object.entries(users).map(([key, user]) => (
@@ -148,14 +154,15 @@ const MyComponent = () => {
148
154
  ### Solution: Comprehensive Translation Strategy
149
155
 
150
156
  **Requirements**:
157
+
151
158
  - Translate role labels and skill names
152
159
  - Handle string interpolation for template text
153
160
  - Provide contextual information for ambiguous terms
154
161
 
155
162
  **Implementation**:
156
- ```jsx
157
- import { useGT } from 'gt-next/client';
158
163
 
164
+ ```jsx
165
+ import { useGT } from 'gt-next';
159
166
  const MyComponent = () => {
160
167
  const t = useGT();
161
168
  const users = {
@@ -175,7 +182,6 @@ const MyComponent = () => {
175
182
  skills: [t('Strategy'), t('Planning'), t('Communication')],
176
183
  },
177
184
  };
178
-
179
185
  return (
180
186
  <div>
181
187
  {Object.entries(users).map(([key, user]) => (
@@ -195,6 +201,7 @@ const MyComponent = () => {
195
201
  ```
196
202
 
197
203
  **Key techniques**:
204
+
198
205
  1. **Context provision**: `{ context: 'As in a software developer' }` for disambiguation
199
206
  2. **Variable interpolation**: `t('Role: {role}', { variables: { role: user.role } })`
200
207
  3. **Systematic translation**: Apply `t()` to all user-facing strings within data structure
@@ -1,4 +1,4 @@
1
- ## Branch Components Overview
1
+ # Guide: Branch Components Overview
2
2
 
3
3
  Branch components dynamically render different content based on conditional values or numeric quantities. They handle locale-aware conditional logic and pluralization rules.
4
4
 
@@ -10,14 +10,8 @@ import { Branch, Plural } from 'gt-next';
10
10
 
11
11
  **Key Behavior:**
12
12
 
13
- - `<Branch>`: Renders content based on conditional branch values
14
- - `<Plural>`: Handles pluralization with locale-specific rules
15
-
16
- **Processing Model:**
17
-
18
- - JSX content → General Translation API for translation
19
- - Branch logic → Local conditional rendering
20
- - `<Plural>` → Uses Unicode CLDR pluralization rules
13
+ - `<Branch>`: Renders content based on conditional branch values.
14
+ - `<Plural>`: Handles pluralization with locale-specific rules. Uses Unicode CLDR pluralization rules.
21
15
 
22
16
  **Important:** When used within `<T>` components, branch content is translated. When used standalone, content renders without translation.
23
17
 
@@ -43,7 +37,7 @@ Branch components use condition-based prop patterns:
43
37
 
44
38
  ### Integration with `<T>` Components
45
39
 
46
- Branch components require translation context for localized content. Use within `<T>` components for automatic translation:
40
+ Branch components require translation context for localized content. Use within `<T>` components to automatically translate content.
47
41
 
48
42
  ```tsx
49
43
  import { T, Branch } from 'gt-next';
@@ -51,10 +45,10 @@ import { T, Branch } from 'gt-next';
51
45
  <T>
52
46
  <Branch
53
47
  branch={status}
54
- active={<p>User is active</p>}
55
- inactive={<p>User is inactive</p>}
48
+ active={<p>User is active</p>} // This content is translated by the <T> component
49
+ inactive={<p>User is inactive</p>} // This content is translated by the <T> component
56
50
  >
57
- Status unknown
51
+ Status unknown {/* This content is translated by the <T> component */}
58
52
  </Branch>
59
53
  </T>;
60
54
  ```
@@ -70,19 +64,24 @@ The `<T>` component provides translation context and localizes branch content.
70
64
  ```tsx
71
65
  import { Plural } from 'gt-next';
72
66
 
73
- <Plural
74
- n={count}
75
- zero={<>No items</>}
76
- one={<>One item</>}
77
- two={<>Two items</>}
78
- few={<>Few items</>}
79
- many={<>Many items</>}
80
- other={<>Other items</>}
81
- dual={<>Dual items</>}
82
- // OR simplified
83
- singular={<>One item</>}
84
- plural={<>Multiple items</>}
85
- />;
67
+ // All content inside the <Plural> component is translated by the <T> component
68
+ <T>
69
+ He has
70
+ <Plural
71
+ n={count}
72
+ zero={<>No items</>}
73
+ one={<>One item</>}
74
+ two={<>Two items</>}
75
+ few={<>Few items</>}
76
+ many={<>Many items</>}
77
+ other={<>Other items</>}
78
+ dual={<>Dual items</>}
79
+ // OR simplified
80
+ singular={<>One item</>}
81
+ plural={<>Multiple items</>}
82
+ />
83
+ .
84
+ </T>;
86
85
  ```
87
86
 
88
87
  **Available Forms:** zero, one, two, few, many, other, dual (locale-dependent), plus simplified singular/plural.
@@ -96,29 +95,34 @@ import { Plural } from 'gt-next';
96
95
  **Replacing Ternary Operators:** Convert inline conditional logic to declarative branch syntax.
97
96
 
98
97
  ```tsx
99
- // Instead of: {isActive ? <p>Active</p> : <p>Inactive</p>}
98
+ // Original:
99
+ {
100
+ isActive ? <p>Active</p> : <p>Inactive</p>;
101
+ }
102
+
103
+ // After:
100
104
  <Branch branch={isActive} true={<p>Active</p>} false={<p>Inactive</p>}>
101
105
  Status unknown
102
- </Branch>
106
+ </Branch>;
103
107
  ```
104
108
 
105
109
  **Important**: the `branch` prop only accepts string values.
106
110
  For example, if isActive is a boolean, convert it to a string first.
107
111
 
108
- **Replacing Conditional Rendering:** Convert `&&` operator patterns to branch syntax.
109
- This is only applicable if the content is being used in a `<T>` component.
112
+ **Replacing Conditional Rendering:** Convert `?` operator patterns to branch syntax.
113
+ This should only be done if the content is being used in a `<T>` component.
110
114
 
111
115
  **Invalid Syntax**:
112
116
 
113
117
  ```tsx
114
- <T>{isActive && <p>Active</p>}</T>
118
+ <T>{isActive ? <p>Active</p> : <p>Inactive</p>}</T>
115
119
  ```
116
120
 
117
121
  **Valid Syntax**:
118
122
 
119
123
  ```tsx
120
124
  <T>
121
- <Branch branch={isActive} true={<p>Active</p>}>
125
+ <Branch branch={isActive} true={<p>Active</p>} false={<p>Inactive</p>}>
122
126
  <></>
123
127
  </Branch>
124
128
  </T>
@@ -128,26 +132,35 @@ This is only applicable if the content is being used in a `<T>` component.
128
132
 
129
133
  ```tsx
130
134
  {
131
- isActive && (
135
+ isActive ? (
132
136
  <T>
133
137
  <p>Active</p>
134
138
  </T>
139
+ ) : (
140
+ <T>
141
+ <p>Inactive</p>
142
+ </T>
135
143
  );
136
144
  }
137
145
  ```
138
146
 
139
- In this case, the `<T>` component is not wrapping the conditional, so the branch component is not needed.
147
+ In the previous example, the `<T>` component is not wrapping the conditional, so the branch component is not needed.
140
148
 
141
149
  ### `<Plural>` - Number-Based Rendering
142
150
 
143
151
  **Basic Pluralization:** Replace manual plural logic with locale-aware components.
144
152
 
145
153
  ```tsx
146
- // Instead of: {count === 1 ? <p>1 item</p> : <p>{count} items</p>}
147
- <Plural n={count} one={<p>1 item</p>} other={<p>{count} items</p>} />
154
+ // Original:
155
+ {
156
+ count === 1 ? <p>1 item</p> : <p>{count} items</p>;
157
+ }
158
+
159
+ // After:
160
+ <Plural n={count} one={<p>1 item</p>} other={<p>{count} items</p>} />;
148
161
  ```
149
162
 
150
- Note: `n` only accepts numbers.
163
+ **Note:** `n` only accepts numbers.
151
164
 
152
165
  **With Variable Integration:** Combine with `<Num>` for formatted numbers.
153
166
 
@@ -211,14 +224,16 @@ const status: string = 'active';
211
224
  **Subscription Tiers:** Standalone usage without translation.
212
225
 
213
226
  ```tsx
214
- <Branch
215
- branch={plan}
216
- free={<p>Free plan - upgrade to unlock features</p>}
217
- premium={<p>Premium plan - full access</p>}
218
- enterprise={<p>Enterprise plan - contact support</p>}
219
- >
220
- No subscription detected
221
- </Branch>
227
+ <T>
228
+ <Branch
229
+ branch={plan}
230
+ free={<p>Free plan - upgrade to unlock features</p>}
231
+ premium={<p>Premium plan - full access</p>}
232
+ enterprise={<p>Enterprise plan - contact support</p>}
233
+ >
234
+ No subscription detected
235
+ </Branch>
236
+ </T>
222
237
  ```
223
238
 
224
239
  ### `<Plural>` - Quantity-Based Content
@@ -308,3 +323,5 @@ import { T, Plural, Num } from 'gt-next';
308
323
  - [`<Branch>`](/docs/next/api/components/branch) - Conditional rendering options
309
324
  - [`<Plural>`](/docs/next/api/components/plural) - Pluralization configuration
310
325
  - [Variable Components](/docs/next/guides/variables) - Integration patterns
326
+
327
+ For more information on Variable Components, see the `mcp__locadex__next_basic_variables` guide.
@@ -1,7 +1,12 @@
1
- # JSX Translation with `<T>` Component
1
+ # Guide: JSX Translation with `<T>` Component
2
2
 
3
3
  Use the `<T>` component to internationalize HTML and JSX content.
4
4
 
5
+ **Key Notes**:
6
+
7
+ - `<T>` components can contain any valid JSX/HTML content, including other components, strings, and other JSX/HTML content.
8
+ - `<T>` components can contain dynamic content, but it must be wrapped in Variable Components or Branching Components.
9
+
5
10
  **Import:** The `<T>` component is exported from `gt-next`.
6
11
 
7
12
  ```tsx
@@ -30,22 +35,20 @@ function Greeting() {
30
35
  }
31
36
  ```
32
37
 
33
- # Context Prop
38
+ ## Context Prop
34
39
 
35
40
  Add `context` prop when content meaning is ambiguous:
36
41
 
37
42
  ```jsx
38
- <T context='toast, as in a pop-up notification'>
39
- Click on the toast to dismiss it.
40
- </T>
43
+ <T context='Crop, as in cropping an image'>Crop</T>
41
44
  ```
42
45
 
43
46
  RULES:
44
47
 
45
- - Provide context for words with multiple meanings (e.g., "toast" = bread vs notification).
46
- - Provide context when the additional context can help the translator understand the meaning of the content.
48
+ - Provide context for words with multiple meanings (e.g., "crop" = cropping an image vs the food crop).
49
+ - Provide context when the additional context can provide more information to the translator about the surrounding content, that is not obvious from the content itself.
47
50
 
48
- # Usage Rules
51
+ ## Usage Rules
49
52
 
50
53
  **USE `<T>` for:**
51
54
 
@@ -54,9 +57,11 @@ RULES:
54
57
 
55
58
  **DO NOT USE `<T>` for:** Raw dynamic content (unwrapped variables, expressions, conditionals)
56
59
 
60
+ ### Notes on Variable Components
61
+
57
62
  Variable components are safe for `<T>` because content is wrapped and sanitized. Variable component content is never translated directly by `<T>`.
58
63
 
59
- ## Invalid Usage Examples (Raw Dynamic Content)
64
+ ### Invalid Usage Examples (Raw Dynamic Content)
60
65
 
61
66
  ```jsx
62
67
  <T>
@@ -82,35 +87,33 @@ Variable components are safe for `<T>` because content is wrapped and sanitized.
82
87
  </T>
83
88
  ```
84
89
 
85
- Solution: Wrap dynamic content in variable components or branching components, then use with `<T>`.
90
+ **Solution: Wrap dynamic content in variable components or branching components, then use with `<T>`.**
86
91
 
87
- # Valid Usage Examples
92
+ ## Valid Usage Examples
88
93
 
89
- ## HTML Content
94
+ ### HTML and JSX Content
90
95
 
91
96
  ```jsx
92
97
  // Before
93
98
  <p>Hello, world!</p>
99
+ <Button>Click me!</Button>
94
100
 
95
101
  // After
96
102
  <T>
97
103
  <p>Hello, world!</p>
98
104
  </T>
99
- ```
100
-
101
- ## Simple JSX Content
102
-
103
- ```jsx
104
- // Before
105
- <Button>Click me!</Button>
105
+ <T>
106
+ <Button>Click me!</Button>
107
+ </T>
106
108
 
107
- // After
109
+ // Or, you can wrap both components with `<T>`
108
110
  <T>
111
+ <p>Hello, world!</p>
109
112
  <Button>Click me!</Button>
110
113
  </T>
111
114
  ```
112
115
 
113
- ## Complex JSX Content
116
+ ### Complex JSX Content
114
117
 
115
118
  ```jsx
116
119
  // Before
@@ -148,11 +151,11 @@ Solution: Wrap dynamic content in variable components or branching components, t
148
151
  </T>
149
152
  ```
150
153
 
151
- NOTE: `<T>` handles any nested content within the same component.
154
+ **NOTE: `<T>` handles any nested content within the same component.**
152
155
 
153
- # Common Pitfalls
156
+ ## Common Pitfalls and Solutions
154
157
 
155
- ## Direct Descendants Only
158
+ ### Direct Descendants Only
156
159
 
157
160
  Rule: `<T>` only translates content directly between its tags. Content inside nested components is not translated.
158
161
 
@@ -174,7 +177,7 @@ export default function DisplayGreetings() {
174
177
 
175
178
  Only content literally between `<T>` tags is translated. The `<h1>` is translated, but `<UntranslatedContent>` is not.
176
179
 
177
- ## Solution
180
+ **Solution:**
178
181
 
179
182
  ```jsx
180
183
  // CORRECT - Each component wraps its own content
@@ -200,7 +203,7 @@ export default function DisplayGreetings() {
200
203
  }
201
204
  ```
202
205
 
203
- ## Nested `<T>` Components
206
+ ### Nested `<T>` Components
204
207
 
205
208
  Rule: Never nest `<T>` components. This causes unexpected behavior and performance issues.
206
209
 
@@ -222,9 +225,9 @@ export default function NestedTranslation() {
222
225
 
223
226
  Solution: Remove the outer `<T>` component.
224
227
 
225
- ## Raw Dynamic Content Error
228
+ ### Raw Dynamic Content Error
226
229
 
227
- CLI will error on raw dynamic content in `<T>`:
230
+ Raw dynamic content in `<T>` will cause an error.
228
231
 
229
232
  ```jsx
230
233
  // WILL ERROR - Raw dynamic content
@@ -234,12 +237,12 @@ const username = 'John Doe';
234
237
  </T>;
235
238
  ```
236
239
 
237
- Solutions:
240
+ **Solutions:**
238
241
 
239
242
  1. Wrap dynamic content in Variable Components or Branching Components, then use with `<T>`
240
- 2. Use `<Tx>` component for on-demand translation
243
+ 2. Use `<Tx>` component for on-demand translation (**use only when necessary, and on server components**)
241
244
 
242
- ## Implementing Variable contents incorrectly
245
+ ### Implementing Variable contents incorrectly
243
246
 
244
247
  The following syntax is wrong and was likely confused with the `useGT()` hook.
245
248
 
@@ -252,14 +255,13 @@ const username = 'John Doe';
252
255
  The correct implementation is as follows:
253
256
 
254
257
  ```jsx
255
- // WILL ERROR - Improper syntax
256
258
  const username = 'John Doe';
257
259
  <T>
258
260
  Hello, <Var>{username}</Var>
259
261
  </T>;
260
262
  ```
261
263
 
262
- # Summary
264
+ ## Summary
263
265
 
264
266
  - Use `<T>` to internationalize static JSX content
265
267
  - Use `<T>` with dynamic content only when wrapped in Variable/Branching Components