@designcrowd/fe-shared-lib 1.5.1-icontranslation → 1.5.1
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/CLAUDE.md +65 -227
- package/{public → dist}/css/tailwind-brandCrowd.css +597 -512
- package/{public → dist}/css/tailwind-brandPage.css +520 -435
- package/{public → dist}/css/tailwind-crazyDomains.css +597 -512
- package/{public → dist}/css/tailwind-designCom.css +597 -512
- package/{public → dist}/css/tailwind-designCrowd.css +597 -512
- package/package.json +1 -1
- package/src/atoms/components/design-com/Icon/Icon.stories.js +0 -62
- package/src/atoms/components/design-com/Icon/Icon.vue +2 -7
- package/.claude/settings.local.json +0 -17
- package/.claude/skills/publishing-test-versions.md +0 -285
- package/.storybook/image-1.png +0 -0
- package/.storybook/image-2.png +0 -0
- package/.storybook/image.png +0 -0
- package/.storybook/test.md +0 -3
- package/APasking.md +0 -9
- package/GT-8753.md +0 -127
- package/docs/plans/2025-11-03-typescript-declarations-design.md +0 -222
package/package.json
CHANGED
|
@@ -80,65 +80,3 @@ export const IconSample = () => {
|
|
|
80
80
|
IconSample.story = {
|
|
81
81
|
name: 'Dcom Icon Library',
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
export const IconInternationalization = () => {
|
|
85
|
-
return {
|
|
86
|
-
components: {
|
|
87
|
-
Icon,
|
|
88
|
-
},
|
|
89
|
-
data() {
|
|
90
|
-
return {
|
|
91
|
-
languages: [
|
|
92
|
-
{ code: 'en', name: 'English' },
|
|
93
|
-
{ code: 'fr', name: 'French' },
|
|
94
|
-
{ code: 'es', name: 'Spanish' },
|
|
95
|
-
{ code: 'pt', name: 'Portuguese' },
|
|
96
|
-
{ code: 'de', name: 'German' },
|
|
97
|
-
],
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
template: `
|
|
101
|
-
<div>
|
|
102
|
-
<h3 class="tw-font-sans tw-mb-4 tw-text-lg tw-font-bold">Internationalization (i18n) Support</h3>
|
|
103
|
-
<p class="tw-font-sans tw-mb-4">The <code>lang</code> prop allows you to specify the language code for screen readers. This is crucial for proper accessibility in internationalized applications.</p>
|
|
104
|
-
|
|
105
|
-
<table class="tw-w-full tw-mb-6">
|
|
106
|
-
<thead>
|
|
107
|
-
<tr>
|
|
108
|
-
<th class="tw-text-left tw-p-4 tw-bg-grayscale-400 tw-font-sans">Language</th>
|
|
109
|
-
<th class="tw-text-left tw-p-4 tw-bg-grayscale-400 tw-font-sans">Icon</th>
|
|
110
|
-
<th class="tw-text-left tw-p-4 tw-bg-grayscale-400 tw-font-sans">Code</th>
|
|
111
|
-
</tr>
|
|
112
|
-
</thead>
|
|
113
|
-
<tr v-for="(language, i) in languages" :key="i" :class="{'tw-bg-grayscale-200': i % 2 !== 0}">
|
|
114
|
-
<td class="tw-p-4 tw-font-sans">{{ language.name }} ({{ language.code }})</td>
|
|
115
|
-
<td class="tw-p-4">
|
|
116
|
-
<Icon name="heart" size="md" :lang="language.code" />
|
|
117
|
-
</td>
|
|
118
|
-
<td class="tw-p-4">
|
|
119
|
-
<code class="tw-bg-info-100 tw-p-2 tw-rounded tw-bg-gray-400 tw-border tw-border-solid tw-border-info-300 tw-text-info-900">
|
|
120
|
-
<Icon name="heart" size="md" lang="{{ language.code }}" />
|
|
121
|
-
</code>
|
|
122
|
-
</td>
|
|
123
|
-
</tr>
|
|
124
|
-
</table>
|
|
125
|
-
|
|
126
|
-
<div class="tw-font-sans tw-bg-blue-50 tw-p-4 tw-rounded tw-border tw-border-blue-200">
|
|
127
|
-
<h4 class="tw-font-bold tw-mb-2">Usage in i18n Applications:</h4>
|
|
128
|
-
<p class="tw-mb-2">In Vue applications with i18n, you can dynamically pass the current locale:</p>
|
|
129
|
-
<pre class="tw-bg-gray-100 tw-p-3 tw-rounded tw-text-sm tw-overflow-x-auto"><code><Icon
|
|
130
|
-
name="feature.iconName"
|
|
131
|
-
size="md"
|
|
132
|
-
:lang="$i18n.locale.split('-')[0]"
|
|
133
|
-
:alt-text="$t('icons.heart.title')"
|
|
134
|
-
/></code></pre>
|
|
135
|
-
<p class="tw-mt-2 tw-text-sm tw-text-gray-600">Note: The lang prop defaults to 'en' for backward compatibility.</p>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
`,
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
IconInternationalization.story = {
|
|
143
|
-
name: 'Internationalization (lang prop)',
|
|
144
|
-
};
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
aria-labelledby="title"
|
|
19
19
|
aria-describedby="desc"
|
|
20
20
|
>
|
|
21
|
-
<title :id="`${name}-${id}-title`"
|
|
22
|
-
<desc :id="`${name}-${id}-desc`"
|
|
21
|
+
<title :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
|
|
22
|
+
<desc :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
|
|
23
23
|
<component :is="`icon-${iconName}`"></component>
|
|
24
24
|
</svg>
|
|
25
25
|
</div>
|
|
@@ -118,11 +118,6 @@ export default {
|
|
|
118
118
|
required: false,
|
|
119
119
|
default: '',
|
|
120
120
|
},
|
|
121
|
-
lang: {
|
|
122
|
-
type: String,
|
|
123
|
-
required: false,
|
|
124
|
-
default: 'en',
|
|
125
|
-
},
|
|
126
121
|
},
|
|
127
122
|
data() {
|
|
128
123
|
return {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"CLAUDE_CODE_USE_BEDROCK": "1",
|
|
4
|
-
"AWS_PROFILE": "default",
|
|
5
|
-
"AWS_REGION": "us-east-1",
|
|
6
|
-
"ANTHROPIC_MODEL": "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
7
|
-
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "10000",
|
|
8
|
-
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
|
9
|
-
},
|
|
10
|
-
"outputStyle": "default",
|
|
11
|
-
"spinnerTipsEnabled": false,
|
|
12
|
-
"permissions": {
|
|
13
|
-
"allow": [
|
|
14
|
-
"Bash(mkdir:*)"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: publishing-test-versions
|
|
3
|
-
description: Use when you need to publish an experimental/test version of fe-shared-lib to NPM for testing in consuming applications before releasing a stable version
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Publishing Test Versions of fe-shared-lib
|
|
7
|
-
|
|
8
|
-
This skill guides you through publishing experimental versions of `@designcrowd/fe-shared-lib` to NPM for testing in consuming applications (BrandCrowd.Net, DesignCrowd, Design.com, etc.) before cutting an official release.
|
|
9
|
-
|
|
10
|
-
## When to Use This Skill
|
|
11
|
-
|
|
12
|
-
Use this skill when:
|
|
13
|
-
- You've implemented changes that need testing in a real consuming application
|
|
14
|
-
- You want to share work-in-progress for integration testing
|
|
15
|
-
- You're verifying a bug fix works in production-like environments
|
|
16
|
-
- You need to test changes across multiple consuming apps before release
|
|
17
|
-
|
|
18
|
-
**Do NOT use for:**
|
|
19
|
-
- Final production releases (use standard release process instead)
|
|
20
|
-
- Changes you haven't tested locally in Storybook
|
|
21
|
-
- Untested or broken code
|
|
22
|
-
|
|
23
|
-
## Pre-Publishing Checklist
|
|
24
|
-
|
|
25
|
-
Before publishing a test version, create TodoWrite todos for these items:
|
|
26
|
-
|
|
27
|
-
1. ☐ Verify all changes work correctly in Storybook (`npm start`)
|
|
28
|
-
2. ☐ Run linting and fix any issues (`npm run lint:fix`)
|
|
29
|
-
3. ☐ Ensure translations are bundled if you modified i18n files
|
|
30
|
-
4. ☐ Check git status - know what changes you're publishing
|
|
31
|
-
5. ☐ Verify NPM_TOKEN environment variable is set
|
|
32
|
-
6. ☐ Verify you're on the correct git account (use `gh auth status`)
|
|
33
|
-
|
|
34
|
-
**IMPORTANT:** NEVER run `npm run build` - it takes too long and isn't required for publishing.
|
|
35
|
-
|
|
36
|
-
## Publishing Workflow
|
|
37
|
-
|
|
38
|
-
### Step 1: Create Descriptive Test Version Number
|
|
39
|
-
|
|
40
|
-
Test versions follow the format: `[current-version]-[description]`
|
|
41
|
-
|
|
42
|
-
**Examples:**
|
|
43
|
-
- `1.5.1-icon-lang-fix` - Testing icon language attribute fix
|
|
44
|
-
- `1.5.1-spinner-variant` - Testing new spinner variant
|
|
45
|
-
- `1.5.1-dcom-checkout` - Testing Design.com checkout changes
|
|
46
|
-
- `1.5.1-test-GT-8753` - Testing specific Jira ticket
|
|
47
|
-
|
|
48
|
-
**Rules:**
|
|
49
|
-
- Use lowercase and hyphens (no spaces, underscores, or special chars)
|
|
50
|
-
- Keep description short but meaningful (2-4 words)
|
|
51
|
-
- Include ticket number if relevant (GT-1234, BP-5678)
|
|
52
|
-
|
|
53
|
-
### Step 2: Update package.json Version
|
|
54
|
-
|
|
55
|
-
1. Read the current version from package.json
|
|
56
|
-
2. Edit package.json to set the test version number
|
|
57
|
-
3. **Example:**
|
|
58
|
-
```json
|
|
59
|
-
"version": "1.5.1-icon-lang-fix"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Step 3: Update package-lock.json
|
|
63
|
-
|
|
64
|
-
Run npm install to update the lock file with the new version:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npm i
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Important:** This MUST be done before building Docker image, or the lock file will be out of sync.
|
|
71
|
-
|
|
72
|
-
### Step 4: Verify NPM_TOKEN Environment Variable
|
|
73
|
-
|
|
74
|
-
Check that NPM_TOKEN is set:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
echo $NPM_TOKEN
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**If empty or undefined:**
|
|
81
|
-
- STOP and ask the user to set NPM_TOKEN
|
|
82
|
-
- The user will need to add it to their environment
|
|
83
|
-
- Do NOT proceed without a valid token
|
|
84
|
-
|
|
85
|
-
### Step 5: Build and Publish via Docker
|
|
86
|
-
|
|
87
|
-
Run the Docker build command which will:
|
|
88
|
-
1. Create a Node 20.11.0 container
|
|
89
|
-
2. Install all dependencies
|
|
90
|
-
3. Bundle translations
|
|
91
|
-
4. Publish to NPM registry
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
npm run docker:publish
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Or directly:
|
|
98
|
-
```bash
|
|
99
|
-
docker build . --build-arg NPM_TOKEN=$NPM_TOKEN
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**Expected output:**
|
|
103
|
-
- You should see npm install logs
|
|
104
|
-
- Translation bundling messages
|
|
105
|
-
- NPM publish success message
|
|
106
|
-
- Final output: "Nothing to do."
|
|
107
|
-
|
|
108
|
-
**If publish fails:**
|
|
109
|
-
- Check Docker output for error messages
|
|
110
|
-
- Common issues:
|
|
111
|
-
- NPM_TOKEN not set or invalid
|
|
112
|
-
- Version number already exists on NPM
|
|
113
|
-
- Network connectivity issues
|
|
114
|
-
- Authentication problems
|
|
115
|
-
|
|
116
|
-
### Step 6: Verify Publication
|
|
117
|
-
|
|
118
|
-
Check that the version was published to NPM:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
npm view @designcrowd/fe-shared-lib versions --json | grep -i "[version-substring]"
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**Example:**
|
|
125
|
-
```bash
|
|
126
|
-
npm view @designcrowd/fe-shared-lib versions --json | grep -i "icon-lang"
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
This confirms the test version is available for consumers to install.
|
|
130
|
-
|
|
131
|
-
### Step 7: Document Test Version for Consumers
|
|
132
|
-
|
|
133
|
-
Create a summary for the user explaining:
|
|
134
|
-
1. The test version number that was published
|
|
135
|
-
2. How to install it in consuming applications:
|
|
136
|
-
```bash
|
|
137
|
-
npm install @designcrowd/fe-shared-lib@1.5.1-icon-lang-fix
|
|
138
|
-
```
|
|
139
|
-
3. What changes are included in this test version
|
|
140
|
-
4. Any testing notes or known limitations
|
|
141
|
-
|
|
142
|
-
**Example message:**
|
|
143
|
-
```
|
|
144
|
-
Successfully published test version: @designcrowd/fe-shared-lib@1.5.1-icon-lang-fix
|
|
145
|
-
|
|
146
|
-
To test in consuming applications:
|
|
147
|
-
npm install @designcrowd/fe-shared-lib@1.5.1-icon-lang-fix
|
|
148
|
-
|
|
149
|
-
Changes in this version:
|
|
150
|
-
- Added lang prop to DcomIcon component
|
|
151
|
-
- Updated SVG title/desc to use dynamic lang attribute
|
|
152
|
-
- Maintains backward compatibility (defaults to 'en')
|
|
153
|
-
|
|
154
|
-
Testing notes:
|
|
155
|
-
- Test with different locales (fr-FR, es-ES, pt-PT)
|
|
156
|
-
- Verify screen readers announce correct language
|
|
157
|
-
- Check that existing usage without lang prop still works
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Post-Publishing Workflow
|
|
161
|
-
|
|
162
|
-
After publishing:
|
|
163
|
-
|
|
164
|
-
1. **Do NOT commit the version change** to git yet - test versions are temporary
|
|
165
|
-
2. Test in consuming application(s)
|
|
166
|
-
3. If issues found:
|
|
167
|
-
- Fix the issues
|
|
168
|
-
- Publish a new test version (e.g., `1.5.1-icon-lang-fix-v2`)
|
|
169
|
-
- Repeat testing
|
|
170
|
-
4. Once testing passes:
|
|
171
|
-
- Revert package.json back to stable version (e.g., `1.5.1`)
|
|
172
|
-
- Make a proper release with version bump (e.g., `1.5.2`)
|
|
173
|
-
- Commit and push the stable release
|
|
174
|
-
|
|
175
|
-
## Git Account Verification
|
|
176
|
-
|
|
177
|
-
**Before publishing, verify you're using the correct GitHub account:**
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
gh auth status
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Expected output for DesignCrowd work:
|
|
184
|
-
```
|
|
185
|
-
Logged in to github.com as KnowlesZ
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
If you're on the wrong account:
|
|
189
|
-
- STOP and inform the user
|
|
190
|
-
- Ask them to switch accounts using `gh auth switch`
|
|
191
|
-
|
|
192
|
-
## Common Pitfalls
|
|
193
|
-
|
|
194
|
-
**Don't:**
|
|
195
|
-
- ❌ Skip updating package-lock.json (causes version mismatch errors)
|
|
196
|
-
- ❌ Commit test versions to git (they're temporary)
|
|
197
|
-
- ❌ Publish with generic names like `1.5.1-test` (not descriptive)
|
|
198
|
-
- ❌ Forget to bundle translations if you modified i18n files
|
|
199
|
-
- ❌ Run `npm run build` (takes forever, not needed)
|
|
200
|
-
- ❌ Publish without linting first
|
|
201
|
-
- ❌ Use the same test version name twice (causes NPM conflicts)
|
|
202
|
-
|
|
203
|
-
**Do:**
|
|
204
|
-
- ✅ Use descriptive test version names
|
|
205
|
-
- ✅ Update both package.json and package-lock.json
|
|
206
|
-
- ✅ Verify NPM_TOKEN before starting
|
|
207
|
-
- ✅ Test in Storybook before publishing
|
|
208
|
-
- ✅ Document what's in the test version for consumers
|
|
209
|
-
- ✅ Clean up by reverting version after testing
|
|
210
|
-
|
|
211
|
-
## Understanding What Gets Published
|
|
212
|
-
|
|
213
|
-
The `.npmignore` file excludes:
|
|
214
|
-
- `node_modules/`
|
|
215
|
-
- `./src` directory (source code is excluded!)
|
|
216
|
-
- `.storybook-static/`
|
|
217
|
-
- Logs, cache files, and IDE configs
|
|
218
|
-
|
|
219
|
-
**What DOES get published:**
|
|
220
|
-
- Compiled/built files in `dist/`
|
|
221
|
-
- `index.js` and `index.cjs` (entry points)
|
|
222
|
-
- Translation bundles
|
|
223
|
-
- `package.json` and lock file
|
|
224
|
-
|
|
225
|
-
This is why the Docker build bundles translations but doesn't require a full build - the source files are published directly.
|
|
226
|
-
|
|
227
|
-
## Docker Build Process Explained
|
|
228
|
-
|
|
229
|
-
The Dockerfile performs these steps:
|
|
230
|
-
1. Creates Node 20.11.0 environment
|
|
231
|
-
2. Copies package files and installs dependencies
|
|
232
|
-
3. Copies the entire project
|
|
233
|
-
4. Runs `npm run bundle-translation` (required for i18n)
|
|
234
|
-
5. Runs `npm publish` (publishes to NPM registry)
|
|
235
|
-
6. Copies package.json to artifacts for verification
|
|
236
|
-
|
|
237
|
-
**Why Docker?**
|
|
238
|
-
- Ensures consistent Node version (20.11.0)
|
|
239
|
-
- Isolates publish environment from local machine
|
|
240
|
-
- Handles NPM authentication securely via build arg
|
|
241
|
-
- Creates reproducible builds
|
|
242
|
-
|
|
243
|
-
## Troubleshooting
|
|
244
|
-
|
|
245
|
-
### "npm publish failed"
|
|
246
|
-
- Check if version already exists: `npm view @designcrowd/fe-shared-lib@[version]`
|
|
247
|
-
- Verify NPM_TOKEN is valid
|
|
248
|
-
- Check network connectivity
|
|
249
|
-
- Look at Docker build output for specific error
|
|
250
|
-
|
|
251
|
-
### "Cannot find NPM_TOKEN"
|
|
252
|
-
- User needs to set environment variable: `export NPM_TOKEN=[token]`
|
|
253
|
-
- Verify with: `echo $NPM_TOKEN`
|
|
254
|
-
- Token must have publish permissions for @designcrowd scope
|
|
255
|
-
|
|
256
|
-
### "Version already exists"
|
|
257
|
-
- Choose a different test version name
|
|
258
|
-
- Append `-v2`, `-v3`, etc. to your description
|
|
259
|
-
- Example: `1.5.1-icon-lang-fix-v2`
|
|
260
|
-
|
|
261
|
-
### Package-lock.json out of sync
|
|
262
|
-
- Always run `npm i` after changing package.json version
|
|
263
|
-
- Commit lock file changes along with package.json
|
|
264
|
-
|
|
265
|
-
### Consumer can't install test version
|
|
266
|
-
- Verify version published: `npm view @designcrowd/fe-shared-lib versions`
|
|
267
|
-
- Check for typos in version string
|
|
268
|
-
- Ensure consuming app has access to @designcrowd scoped packages
|
|
269
|
-
|
|
270
|
-
## Summary Checklist
|
|
271
|
-
|
|
272
|
-
Use TodoWrite to create todos for each step:
|
|
273
|
-
|
|
274
|
-
1. ☐ Run linting (`npm run lint:fix`)
|
|
275
|
-
2. ☐ Test changes in Storybook (`npm start`)
|
|
276
|
-
3. ☐ Verify git account is correct (`gh auth status`)
|
|
277
|
-
4. ☐ Create descriptive test version number
|
|
278
|
-
5. ☐ Update package.json version
|
|
279
|
-
6. ☐ Run `npm i` to update lock file
|
|
280
|
-
7. ☐ Verify NPM_TOKEN is set (`echo $NPM_TOKEN`)
|
|
281
|
-
8. ☐ Run `npm run docker:publish`
|
|
282
|
-
9. ☐ Verify publication with `npm view`
|
|
283
|
-
10. ☐ Document test version for user
|
|
284
|
-
|
|
285
|
-
Remember: Test versions are temporary. Don't commit them to git. After testing succeeds, revert the version and create a proper release.
|
package/.storybook/image-1.png
DELETED
|
Binary file
|
package/.storybook/image-2.png
DELETED
|
Binary file
|
package/.storybook/image.png
DELETED
|
Binary file
|
package/.storybook/test.md
DELETED
package/APasking.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Ask brooke about the critical gap between speed curve and DD rum
|
|
2
|
-
- Missing data points like blocking time?
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Get questions together to give to DD solution architect before
|
|
6
|
-
- How do we get metrics on the nuxt internals
|
|
7
|
-
- How can get get API calls made correlated?
|
|
8
|
-
- Would be good to just have the different types of processing that happens in the SSR/client tracked and mapped.
|
|
9
|
-
|
package/GT-8753.md
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# GT-8753: SVG Icon Translation Issue - Problem & Solution
|
|
2
|
-
|
|
3
|
-
## Problem Description
|
|
4
|
-
|
|
5
|
-
The `DcomIcon` component in `@designcrowd/fe-shared-lib` (v1.4.9) has hardcoded `lang="en"` attributes in its SVG `<title>` and `<desc>` accessibility elements, preventing proper internationalization.
|
|
6
|
-
|
|
7
|
-
**Current Code** (`Icon.vue` lines 21-22):
|
|
8
|
-
```vue
|
|
9
|
-
<title :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
|
|
10
|
-
<desc :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
**Impact**: All Design.com pages using DcomIcon display English accessibility text regardless of the user's locale (fr-FR, es-ES, pt-PT, etc.), creating a poor experience for non-English users and failing accessibility standards for internationalized content.
|
|
14
|
-
|
|
15
|
-
**Affected Pages in BrandCrowd.Net**:
|
|
16
|
-
- `/maker/free-logos`
|
|
17
|
-
- `/business-name-generator`
|
|
18
|
-
- `/maker/contact`
|
|
19
|
-
- `/logo-maker`
|
|
20
|
-
- Multi-Asset homemaker pages (e.g., `/facebook-covers`)
|
|
21
|
-
|
|
22
|
-
**Used in 6 components** across BrandCrowd.Net's Nuxt application.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Proposed Solution
|
|
27
|
-
|
|
28
|
-
### 1. Add a `lang` Prop to DcomIcon Component
|
|
29
|
-
|
|
30
|
-
**File**: `src/atoms/components/design-com/Icon/Icon.vue`
|
|
31
|
-
|
|
32
|
-
Add a new optional prop to accept the language code:
|
|
33
|
-
|
|
34
|
-
```vue
|
|
35
|
-
<script>
|
|
36
|
-
export default {
|
|
37
|
-
props: {
|
|
38
|
-
// ... existing props ...
|
|
39
|
-
lang: {
|
|
40
|
-
type: String,
|
|
41
|
-
required: false,
|
|
42
|
-
default: 'en', // fallback to English
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
// ... rest of component ...
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 2. Update Template to Use Dynamic Lang Attribute
|
|
51
|
-
|
|
52
|
-
**Change lines 21-22** from:
|
|
53
|
-
```vue
|
|
54
|
-
<title :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
|
|
55
|
-
<desc :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
To:
|
|
59
|
-
```vue
|
|
60
|
-
<title :id="`${name}-${id}-title`" :lang="lang">{{ title }}</title>
|
|
61
|
-
<desc :id="`${name}-${id}-desc`" :lang="lang">{{ description }}</desc>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 3. Consumer Usage Pattern
|
|
65
|
-
|
|
66
|
-
Consumers (like BrandCrowd.Net) can then pass the current locale:
|
|
67
|
-
|
|
68
|
-
```vue
|
|
69
|
-
<template>
|
|
70
|
-
<DcomIcon
|
|
71
|
-
:name="feature.iconName"
|
|
72
|
-
size="md"
|
|
73
|
-
:lang="currentLang"
|
|
74
|
-
:alt-text="$t(`icons.${feature.iconName}.title`)"
|
|
75
|
-
/>
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<script setup>
|
|
79
|
-
const { locale } = useI18n();
|
|
80
|
-
// Convert 'fr-FR' to 'fr' for HTML lang attribute
|
|
81
|
-
const currentLang = computed(() => locale.value.split('-')[0]);
|
|
82
|
-
</script>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Benefits
|
|
88
|
-
|
|
89
|
-
✅ **Backward Compatible**: Default value of `'en'` preserves existing behavior
|
|
90
|
-
✅ **Minimal Change**: Only 3 lines modified in the component
|
|
91
|
-
✅ **Flexible**: Consumers control the language based on their i18n setup
|
|
92
|
-
✅ **Standards Compliant**: Proper `lang` attributes improve accessibility
|
|
93
|
-
✅ **Simple**: No complex translation logic needed in the shared library
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Testing Checklist
|
|
98
|
-
|
|
99
|
-
- [ ] Verify `lang` prop defaults to `'en'` when not provided
|
|
100
|
-
- [ ] Test passing different language codes ('fr', 'es', 'pt', 'de')
|
|
101
|
-
- [ ] Confirm rendered HTML shows correct `lang` attribute in title/desc
|
|
102
|
-
- [ ] Update Storybook story to demonstrate lang prop usage
|
|
103
|
-
- [ ] Verify no breaking changes to existing consumers
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Implementation Notes
|
|
108
|
-
|
|
109
|
-
**Why this approach works well:**
|
|
110
|
-
|
|
111
|
-
1. **Separation of Concerns**: The shared library handles rendering with the correct lang attribute, while consumers handle translation logic specific to their i18n setup
|
|
112
|
-
2. **Accessibility Best Practice**: The `lang` attribute tells screen readers which language pronunciation rules to use, critical for international users
|
|
113
|
-
3. **Minimal Surface Area**: Adding a single prop is safer than building complex translation logic into a shared component library
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## File Location in fe-shared-lib
|
|
118
|
-
|
|
119
|
-
**Primary file to modify:**
|
|
120
|
-
- `src/atoms/components/design-com/Icon/Icon.vue`
|
|
121
|
-
|
|
122
|
-
**Lines to change:**
|
|
123
|
-
- Line 21-22 (template)
|
|
124
|
-
- Props definition (add `lang` prop)
|
|
125
|
-
|
|
126
|
-
**Current component location in BrandCrowd.Net node_modules:**
|
|
127
|
-
- `/home/zknowles/BrandCrowd.Net/BrandCrowd.Nuxt/node_modules/@designcrowd/fe-shared-lib/src/atoms/components/design-com/Icon/Icon.vue`
|