@asafarim/shared-i18n 0.5.2 → 0.6.0
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 +170 -168
- package/demo/index.html +13 -0
- package/demo/node_modules/.bin/tsc +21 -0
- package/demo/node_modules/.bin/tsserver +21 -0
- package/demo/node_modules/.bin/vite +21 -0
- package/demo/package.json +24 -0
- package/demo/public/favicon.svg +4 -0
- package/demo/public/logo.svg +24 -0
- package/demo/src/App.tsx +112 -0
- package/demo/src/components/GetStartedSection.tsx +56 -0
- package/demo/src/components/KeyTable.tsx +29 -0
- package/demo/src/components/LanguageBar.tsx +19 -0
- package/demo/src/components/LanguageSwitcherDemo.module.css +113 -0
- package/demo/src/components/LanguageSwitcherDemo.tsx +184 -0
- package/demo/src/components/OverviewSection.tsx +43 -0
- package/demo/src/components/Panel.tsx +15 -0
- package/demo/src/components/StatusCard.tsx +109 -0
- package/demo/src/index.css +569 -0
- package/demo/src/locales/en/demo.json +85 -0
- package/demo/src/locales/fr/demo.json +85 -0
- package/demo/src/locales/nl/demo.json +85 -0
- package/demo/src/main.tsx +24 -0
- package/demo/tsconfig.json +18 -0
- package/demo/tsconfig.node.json +10 -0
- package/demo/vite-env.d.ts +7 -0
- package/demo/vite.config.ts +11 -0
- package/dist/components/LanguageSwitcher.d.ts +20 -0
- package/dist/components/LanguageSwitcher.d.ts.map +1 -0
- package/dist/components/LanguageSwitcher.js +72 -0
- package/dist/components/LanguageSwitcher.module.css +205 -0
- package/dist/config/i18n.d.ts +46 -0
- package/dist/config/i18n.d.ts.map +1 -0
- package/dist/config/i18n.js +66 -0
- package/dist/hooks/useLanguage.d.ts +12 -0
- package/dist/hooks/useLanguage.d.ts.map +1 -0
- package/dist/hooks/useLanguage.js +61 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/locales/en/common.json +68 -0
- package/{locales → dist/locales}/en/identity-portal.json +69 -69
- package/dist/locales/nl/common.json +68 -0
- package/{locales → dist/locales}/nl/identity-portal.json +69 -69
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/languageIcons.d.ts +4 -0
- package/dist/utils/languageIcons.d.ts.map +1 -0
- package/dist/utils/languageIcons.js +12 -0
- package/dist/utils/languageUtils.d.ts +45 -0
- package/dist/utils/languageUtils.d.ts.map +1 -0
- package/dist/utils/languageUtils.js +144 -0
- package/package.json +34 -22
- package/LICENSE +0 -23
- package/config/i18n.ts +0 -89
- package/hooks/useLanguage.ts +0 -80
- package/index.ts +0 -21
- package/locales/en/common.json +0 -66
- package/locales/en/web.json +0 -343
- package/locales/nl/common.json +0 -66
- package/locales/nl/web.json +0 -343
- package/tsconfig.json +0 -32
- package/utils/languageUtils.ts +0 -141
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
@import "@asafarim/design-tokens/css";
|
|
2
|
+
|
|
3
|
+
* {
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
body {
|
|
10
|
+
font-family: var(--asm-font-family-base, 'Inter', sans-serif);
|
|
11
|
+
-webkit-font-smoothing: antialiased;
|
|
12
|
+
-moz-osx-font-smoothing: grayscale;
|
|
13
|
+
background-color: var(--asm-color-bg);
|
|
14
|
+
color: var(--asm-color-text);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.app-container {
|
|
18
|
+
min-height: 100vh;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.app-header {
|
|
24
|
+
background-color: var(--asm-color-primary-600);
|
|
25
|
+
color: var(--asm-color-bg);
|
|
26
|
+
padding: var(--asm-space-10);
|
|
27
|
+
box-shadow: var(--asm-effect-shadow-md);
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
align-items: flex-start;
|
|
31
|
+
gap: var(--asm-space-6);
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.header-content {
|
|
36
|
+
flex: 1;
|
|
37
|
+
min-width: 300px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.app-header h1 {
|
|
41
|
+
font-size: 2rem;
|
|
42
|
+
margin-bottom: var(--asm-space-2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.subtitle {
|
|
46
|
+
font-size: 0.95rem;
|
|
47
|
+
opacity: 0.9;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.app-main {
|
|
51
|
+
flex: 1;
|
|
52
|
+
max-width: 1200px;
|
|
53
|
+
width: 100%;
|
|
54
|
+
margin: 0 auto;
|
|
55
|
+
padding: var(--asm-space-10);
|
|
56
|
+
gap: var(--asm-space-10);
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.panel {
|
|
62
|
+
background-color: var(--asm-color-surface);
|
|
63
|
+
border: 1px solid var(--asm-color-border);
|
|
64
|
+
border-radius: var(--asm-radius-lg);
|
|
65
|
+
padding: var(--asm-space-6);
|
|
66
|
+
box-shadow: var(--asm-effect-shadow-sm);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.panel-title {
|
|
70
|
+
font-size: 1.25rem;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
margin-bottom: var(--asm-space-4);
|
|
73
|
+
color: var(--asm-color-text);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.panel-grid {
|
|
77
|
+
display: grid;
|
|
78
|
+
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
|
79
|
+
gap: var(--asm-space-6);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.panel-grid h3 {
|
|
83
|
+
font-size: 1rem;
|
|
84
|
+
margin-bottom: var(--asm-space-3);
|
|
85
|
+
color: var(--asm-color-text-muted);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.key-table {
|
|
89
|
+
width: 100%;
|
|
90
|
+
border-collapse: collapse;
|
|
91
|
+
font-size: 0.9rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.key-table th,
|
|
95
|
+
.key-table td {
|
|
96
|
+
padding: var(--asm-space-4);
|
|
97
|
+
text-align: left;
|
|
98
|
+
border-bottom: 1px solid var(--asm-color-border);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.key-table th {
|
|
102
|
+
background-color: var(--asm-color-surface-muted);
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
color: var(--asm-color-text-muted);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.key-table tr:hover {
|
|
108
|
+
background-color: var(--asm-color-surface-muted);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.language-bar {
|
|
112
|
+
display: flex;
|
|
113
|
+
gap: var(--asm-space-3);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.lang-button {
|
|
117
|
+
padding: var(--asm-space-2) var(--asm-space-4);
|
|
118
|
+
border: 2px solid var(--asm-color-bg);
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
color: var(--asm-color-bg);
|
|
121
|
+
border-radius: var(--asm-radius-md);
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
font-size: 0.95rem;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
transition: all 0.2s ease;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.lang-button:hover:not(:disabled) {
|
|
129
|
+
background-color: var(--asm-color-button-ghost-bg-hover);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.lang-button.active {
|
|
133
|
+
background-color: var(--asm-color-bg);
|
|
134
|
+
color: var(--asm-color-primary-600);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.lang-button:disabled {
|
|
138
|
+
opacity: 0.6;
|
|
139
|
+
cursor: not-allowed;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.interpolation-demo {
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
gap: var(--asm-space-6);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.demo-item {
|
|
149
|
+
padding: var(--asm-space-6);
|
|
150
|
+
background-color: var(--asm-color-surface-muted);
|
|
151
|
+
border-radius: var(--asm-radius-md);
|
|
152
|
+
border-left: 4px solid var(--asm-color-primary-600);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.demo-item h4 {
|
|
156
|
+
font-size: 0.95rem;
|
|
157
|
+
margin-bottom: var(--asm-space-3);
|
|
158
|
+
color: var(--asm-color-text-muted);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.demo-output {
|
|
162
|
+
font-size: 1rem;
|
|
163
|
+
color: var(--asm-color-text);
|
|
164
|
+
font-weight: 500;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.status-grid {
|
|
168
|
+
display: grid;
|
|
169
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
170
|
+
gap: var(--asm-space-6);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.status-card {
|
|
174
|
+
background-color: var(--asm-color-surface-muted);
|
|
175
|
+
border: 1px solid var(--asm-color-border);
|
|
176
|
+
border-radius: var(--asm-radius-md);
|
|
177
|
+
padding: var(--asm-space-6);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.status-card h4 {
|
|
181
|
+
font-size: 0.9rem;
|
|
182
|
+
color: var(--asm-color-text-muted);
|
|
183
|
+
margin-bottom: var(--asm-space-2);
|
|
184
|
+
text-transform: uppercase;
|
|
185
|
+
letter-spacing: 0.05em;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.status-card p {
|
|
189
|
+
font-size: 1rem;
|
|
190
|
+
color: var(--asm-color-text);
|
|
191
|
+
word-break: break-all;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.status-list {
|
|
195
|
+
list-style: none;
|
|
196
|
+
margin-top: var(--asm-space-3);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.status-list li {
|
|
200
|
+
padding: var(--asm-space-2) 0;
|
|
201
|
+
color: var(--asm-color-text);
|
|
202
|
+
font-size: 0.95rem;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.sync-button {
|
|
206
|
+
margin-top: var(--asm-space-4);
|
|
207
|
+
padding: var(--asm-space-3) var(--asm-space-6);
|
|
208
|
+
background-color: var(--asm-color-button-primary-bg);
|
|
209
|
+
color: var(--asm-color-button-primary-text);
|
|
210
|
+
border: none;
|
|
211
|
+
border-radius: var(--asm-radius-md);
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
font-size: 0.95rem;
|
|
214
|
+
font-weight: 500;
|
|
215
|
+
transition: all 0.2s ease;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.sync-button:hover:not(:disabled) {
|
|
219
|
+
background-color: var(--asm-color-button-primary-bg-hover);
|
|
220
|
+
box-shadow: var(--asm-effect-shadow-sm);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.sync-button:disabled {
|
|
224
|
+
opacity: 0.6;
|
|
225
|
+
cursor: not-allowed;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.sync-result {
|
|
229
|
+
margin-top: var(--asm-space-3);
|
|
230
|
+
padding: var(--asm-space-4);
|
|
231
|
+
border-radius: var(--asm-radius-md);
|
|
232
|
+
font-size: 0.9rem;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.sync-result.success {
|
|
236
|
+
background-color: var(--asm-color-success-100);
|
|
237
|
+
color: var(--asm-color-success-600);
|
|
238
|
+
border: 1px solid var(--asm-color-success-200);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.sync-result.error {
|
|
242
|
+
background-color: var(--asm-color-danger-100);
|
|
243
|
+
color: var(--asm-color-danger-600);
|
|
244
|
+
border: 1px solid var(--asm-color-danger-200);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.nav-tabs {
|
|
248
|
+
display: flex;
|
|
249
|
+
gap: var(--asm-space-2);
|
|
250
|
+
margin-bottom: var(--asm-space-6);
|
|
251
|
+
border-bottom: 2px solid var(--asm-color-border);
|
|
252
|
+
overflow-x: auto;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.nav-tab {
|
|
256
|
+
padding: var(--asm-space-3) var(--asm-space-4);
|
|
257
|
+
background: none;
|
|
258
|
+
border: none;
|
|
259
|
+
border-bottom: 3px solid transparent;
|
|
260
|
+
color: var(--asm-color-text-muted);
|
|
261
|
+
cursor: pointer;
|
|
262
|
+
font-size: 0.95rem;
|
|
263
|
+
font-weight: 500;
|
|
264
|
+
transition: all var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
265
|
+
white-space: nowrap;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.nav-tab:hover {
|
|
269
|
+
color: var(--asm-color-text);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.nav-tab.active {
|
|
273
|
+
color: var(--asm-color-primary-600);
|
|
274
|
+
border-bottom-color: var(--asm-color-primary-600);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.overview-section {
|
|
278
|
+
animation: fadeIn var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.overview-header {
|
|
282
|
+
margin-bottom: var(--asm-space-8);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.overview-title {
|
|
286
|
+
font-size: 2rem;
|
|
287
|
+
font-weight: 700;
|
|
288
|
+
color: var(--asm-color-text);
|
|
289
|
+
margin-bottom: var(--asm-space-3);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.overview-description {
|
|
293
|
+
font-size: 1.125rem;
|
|
294
|
+
color: var(--asm-color-text-muted);
|
|
295
|
+
line-height: 1.6;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.overview-grid {
|
|
299
|
+
display: grid;
|
|
300
|
+
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
|
|
301
|
+
gap: var(--asm-space-6);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.feature-card {
|
|
305
|
+
background: linear-gradient(135deg, var(--asm-color-surface) 0%, var(--asm-color-surface-muted) 100%);
|
|
306
|
+
border: 1px solid var(--asm-color-border);
|
|
307
|
+
border-radius: var(--asm-radius-lg);
|
|
308
|
+
padding: var(--asm-space-6);
|
|
309
|
+
transition: all var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.feature-card:hover {
|
|
313
|
+
transform: translateY(-4px);
|
|
314
|
+
box-shadow: var(--asm-effect-shadow-lg);
|
|
315
|
+
border-color: var(--asm-color-primary-600);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.feature-icon {
|
|
319
|
+
font-size: 2.5rem;
|
|
320
|
+
margin-bottom: var(--asm-space-3);
|
|
321
|
+
display: inline-block;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.feature-card h3 {
|
|
325
|
+
font-size: 1.25rem;
|
|
326
|
+
font-weight: 600;
|
|
327
|
+
color: var(--asm-color-text);
|
|
328
|
+
margin-bottom: var(--asm-space-4);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.feature-list {
|
|
332
|
+
list-style: none;
|
|
333
|
+
display: flex;
|
|
334
|
+
flex-direction: column;
|
|
335
|
+
gap: var(--asm-space-3);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.feature-list li {
|
|
339
|
+
display: flex;
|
|
340
|
+
align-items: flex-start;
|
|
341
|
+
gap: var(--asm-space-2);
|
|
342
|
+
color: var(--asm-color-text);
|
|
343
|
+
line-height: 1.5;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.feature-dot {
|
|
347
|
+
color: var(--asm-color-primary-600);
|
|
348
|
+
font-weight: bold;
|
|
349
|
+
flex-shrink: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.get-started-section {
|
|
353
|
+
animation: fadeIn var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.gs-header {
|
|
357
|
+
margin-bottom: var(--asm-space-8);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.gs-title {
|
|
361
|
+
font-size: 2rem;
|
|
362
|
+
font-weight: 700;
|
|
363
|
+
color: var(--asm-color-text);
|
|
364
|
+
margin-bottom: var(--asm-space-3);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.gs-intro {
|
|
368
|
+
font-size: 1.125rem;
|
|
369
|
+
color: var(--asm-color-text-muted);
|
|
370
|
+
line-height: 1.6;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.steps-container {
|
|
374
|
+
display: flex;
|
|
375
|
+
flex-direction: column;
|
|
376
|
+
gap: var(--asm-space-4);
|
|
377
|
+
margin-bottom: var(--asm-space-8);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.step-item {
|
|
381
|
+
border: 1px solid var(--asm-color-border);
|
|
382
|
+
border-radius: var(--asm-radius-lg);
|
|
383
|
+
overflow: hidden;
|
|
384
|
+
transition: all var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.step-item:hover {
|
|
388
|
+
border-color: var(--asm-color-primary-600);
|
|
389
|
+
box-shadow: var(--asm-effect-shadow-md);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.step-header {
|
|
393
|
+
width: 100%;
|
|
394
|
+
display: flex;
|
|
395
|
+
align-items: center;
|
|
396
|
+
gap: var(--asm-space-4);
|
|
397
|
+
padding: var(--asm-space-4) var(--asm-space-6);
|
|
398
|
+
background-color: var(--asm-color-surface);
|
|
399
|
+
border: none;
|
|
400
|
+
cursor: pointer;
|
|
401
|
+
transition: all var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.step-header:hover {
|
|
405
|
+
background-color: var(--asm-color-surface-muted);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.step-header.expanded {
|
|
409
|
+
background-color: var(--asm-color-surface-muted);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.step-number {
|
|
413
|
+
display: flex;
|
|
414
|
+
align-items: center;
|
|
415
|
+
justify-content: center;
|
|
416
|
+
width: 40px;
|
|
417
|
+
height: 40px;
|
|
418
|
+
border-radius: var(--asm-radius-full);
|
|
419
|
+
background: linear-gradient(135deg, var(--asm-color-primary-600) 0%, var(--asm-color-primary-700) 100%);
|
|
420
|
+
color: white;
|
|
421
|
+
font-weight: 700;
|
|
422
|
+
font-size: 1.125rem;
|
|
423
|
+
flex-shrink: 0;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.step-info {
|
|
427
|
+
flex: 1;
|
|
428
|
+
text-align: left;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.step-info h3 {
|
|
432
|
+
font-size: 1rem;
|
|
433
|
+
font-weight: 600;
|
|
434
|
+
color: var(--asm-color-text);
|
|
435
|
+
margin-bottom: var(--asm-space-1);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.step-info p {
|
|
439
|
+
font-size: 0.9rem;
|
|
440
|
+
color: var(--asm-color-text-muted);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.step-toggle {
|
|
444
|
+
font-size: 1.5rem;
|
|
445
|
+
color: var(--asm-color-primary-600);
|
|
446
|
+
font-weight: bold;
|
|
447
|
+
flex-shrink: 0;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.step-content {
|
|
451
|
+
padding: var(--asm-space-6);
|
|
452
|
+
background-color: var(--asm-color-surface-muted);
|
|
453
|
+
border-top: 1px solid var(--asm-color-border);
|
|
454
|
+
animation: slideDown var(--asm-motion-duration-normal) var(--asm-motion-easing-standard);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.code-block {
|
|
458
|
+
background-color: var(--asm-color-text);
|
|
459
|
+
color: var(--asm-color-bg);
|
|
460
|
+
padding: var(--asm-space-4);
|
|
461
|
+
border-radius: var(--asm-radius-md);
|
|
462
|
+
overflow-x: auto;
|
|
463
|
+
font-family: var(--asm-font-family-mono, monospace);
|
|
464
|
+
font-size: 0.85rem;
|
|
465
|
+
line-height: 1.5;
|
|
466
|
+
margin: 0;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.tips-section {
|
|
470
|
+
display: flex;
|
|
471
|
+
gap: var(--asm-space-6);
|
|
472
|
+
padding: var(--asm-space-6);
|
|
473
|
+
background: linear-gradient(135deg, var(--asm-color-primary-50) 0%, var(--asm-color-secondary-50) 100%);
|
|
474
|
+
border: 2px solid var(--asm-color-primary-200);
|
|
475
|
+
border-radius: var(--asm-radius-lg);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.tips-icon {
|
|
479
|
+
font-size: 2rem;
|
|
480
|
+
flex-shrink: 0;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.tips-content h3 {
|
|
484
|
+
font-size: 1.125rem;
|
|
485
|
+
font-weight: 600;
|
|
486
|
+
color: var(--asm-color-text);
|
|
487
|
+
margin-bottom: var(--asm-space-3);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.tips-list {
|
|
491
|
+
list-style: none;
|
|
492
|
+
display: flex;
|
|
493
|
+
flex-direction: column;
|
|
494
|
+
gap: var(--asm-space-2);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.tips-list li {
|
|
498
|
+
display: flex;
|
|
499
|
+
align-items: flex-start;
|
|
500
|
+
gap: var(--asm-space-2);
|
|
501
|
+
color: var(--asm-color-text);
|
|
502
|
+
font-size: 0.95rem;
|
|
503
|
+
line-height: 1.5;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.tips-list li::before {
|
|
507
|
+
content: "✓";
|
|
508
|
+
color: var(--asm-color-semantic-success);
|
|
509
|
+
font-weight: bold;
|
|
510
|
+
flex-shrink: 0;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
@media (max-width: 768px) {
|
|
514
|
+
.app-header {
|
|
515
|
+
flex-direction: column;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.app-main {
|
|
519
|
+
padding: var(--asm-space-6);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.panel-grid {
|
|
523
|
+
grid-template-columns: 1fr;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.app-header h1 {
|
|
527
|
+
font-size: 1.5rem;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.overview-grid {
|
|
531
|
+
grid-template-columns: 1fr;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.tips-section {
|
|
535
|
+
flex-direction: column;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.step-header {
|
|
539
|
+
flex-direction: column;
|
|
540
|
+
align-items: flex-start;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.step-toggle {
|
|
544
|
+
align-self: flex-end;
|
|
545
|
+
margin-top: calc(var(--asm-space-4) * -1);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
@keyframes fadeIn {
|
|
550
|
+
from {
|
|
551
|
+
opacity: 0;
|
|
552
|
+
transform: translateY(8px);
|
|
553
|
+
}
|
|
554
|
+
to {
|
|
555
|
+
opacity: 1;
|
|
556
|
+
transform: translateY(0);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
@keyframes slideDown {
|
|
561
|
+
from {
|
|
562
|
+
opacity: 0;
|
|
563
|
+
max-height: 0;
|
|
564
|
+
}
|
|
565
|
+
to {
|
|
566
|
+
opacity: 1;
|
|
567
|
+
max-height: 500px;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Shared i18n demo",
|
|
3
|
+
"subtitle": "A lightweight React i18next wrapper with cookie persistence.",
|
|
4
|
+
"cta": "Switch language",
|
|
5
|
+
"overview": {
|
|
6
|
+
"heading": "Overview",
|
|
7
|
+
"description": "@asafarim/shared-i18n is a production-grade internationalization (i18n) package for React applications.",
|
|
8
|
+
"features": {
|
|
9
|
+
"title": "Key Features",
|
|
10
|
+
"items": [
|
|
11
|
+
"Multi-language support with cookie persistence",
|
|
12
|
+
"Built-in language detection and fallback",
|
|
13
|
+
"TypeScript support with full type safety",
|
|
14
|
+
"Pre-configured with common and identity-portal namespaces",
|
|
15
|
+
"Seamless integration with react-i18next",
|
|
16
|
+
"Backend language preference synchronization",
|
|
17
|
+
"SSR-safe utilities for server-side rendering"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"useCases": {
|
|
21
|
+
"title": "Perfect For",
|
|
22
|
+
"items": [
|
|
23
|
+
"Global applications requiring multi-language support",
|
|
24
|
+
"Enterprise platforms with user language preferences",
|
|
25
|
+
"Identity and authentication systems",
|
|
26
|
+
"Content management systems with localization",
|
|
27
|
+
"SaaS applications serving international users"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"getStarted": {
|
|
32
|
+
"heading": "Get Started",
|
|
33
|
+
"intro": "Learn how to integrate @asafarim/shared-i18n into your React application in minutes.",
|
|
34
|
+
"steps": [
|
|
35
|
+
{
|
|
36
|
+
"title": "1. Install the Package",
|
|
37
|
+
"description": "Add the package to your project dependencies.",
|
|
38
|
+
"code": "pnpm add @asafarim/shared-i18n"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "2. Initialize i18n in Your App",
|
|
42
|
+
"description": "Call initI18n at application startup to configure language settings.",
|
|
43
|
+
"code": "import { initI18n } from '@asafarim/shared-i18n';\n\ninitI18n({\n defaultNS: 'common',\n ns: ['common', 'identityPortal'],\n resources: { /* your translations */ }\n});"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"title": "3. Use the useLanguage Hook",
|
|
47
|
+
"description": "Access language switching and current language state in your components.",
|
|
48
|
+
"code": "const { changeLanguage, isChanging } = useLanguage();\n\n<button onClick={() => changeLanguage('nl')}>\n Switch to Dutch\n</button>"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"title": "4. Translate with useTranslation",
|
|
52
|
+
"description": "Use the useTranslation hook to access translated strings.",
|
|
53
|
+
"code": "const { t } = useTranslation('common');\n\n<h1>{t('welcome')}</h1>"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"title": "5. Leverage Cookie Persistence",
|
|
57
|
+
"description": "User language preferences are automatically saved and restored.",
|
|
58
|
+
"code": "// Automatically persisted via cookies\n// No additional setup required!"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"title": "6. Sync with Backend (Optional)",
|
|
62
|
+
"description": "Update user language preferences on your backend.",
|
|
63
|
+
"code": "import { updateUserLanguagePreference } from '@asafarim/shared-i18n';\n\nawait updateUserLanguagePreference('en');"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"tips": {
|
|
67
|
+
"title": "Pro Tips",
|
|
68
|
+
"items": [
|
|
69
|
+
"Use namespaces to organize translations by feature",
|
|
70
|
+
"Leverage the Trans component for complex translations with variables",
|
|
71
|
+
"Set VITE_IDENTITY_API_URL for backend synchronization",
|
|
72
|
+
"Check browser language detection with getInitialLanguage()",
|
|
73
|
+
"Combine with design tokens for consistent theming across languages"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"status": {
|
|
78
|
+
"heading": "Live status",
|
|
79
|
+
"cookie": "Cookie",
|
|
80
|
+
"backend": "Backend",
|
|
81
|
+
"simulate": "Simulate backend sync",
|
|
82
|
+
"resultOk": "Backend sync succeeded",
|
|
83
|
+
"resultFail": "Backend sync failed"
|
|
84
|
+
}
|
|
85
|
+
}
|