@furystack/shades-i18n 1.0.11 → 1.0.13

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 (2) hide show
  1. package/README.md +42 -3
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,7 +1,46 @@
1
1
  # shades-i18n
2
2
 
3
- Internationalization package for FuryStack Shades UI
3
+ Internationalization package for FuryStack Shades UI.
4
4
 
5
- ## Usage example
5
+ ## Usage Example
6
6
 
7
- --- TODO ---
7
+ ```ts
8
+ import { createLanguage, I18NService } from '@furystack/i18n'
9
+ import { createI18nComponent } from '@furystack/shades-i18n'
10
+
11
+ // Examples imported from JSON files
12
+ import de from './de.json' with { type: 'json' }
13
+ import en from './en.json' with { type: 'json' }
14
+ import es from './es.json' with { type: 'json' }
15
+
16
+ // Examples created manually
17
+ const hu = createLanguage({
18
+ code: 'hu',
19
+ values: {
20
+ greeting: 'Szia',
21
+ farewell: 'Viszlát',
22
+ },
23
+ })
24
+
25
+ const fr = createLanguage({
26
+ code: 'fr',
27
+ values: {
28
+ greeting: 'Bonjour',
29
+ // farewell: 'Au revoir', // Should fall back to en
30
+ },
31
+ })
32
+
33
+ const service = new I18NService(en, de, hu, fr, es)
34
+
35
+ const TranslatedComponent = createI18nComponent({
36
+ service,
37
+ shadowDomName: 'i18n-page-translated-component',
38
+ })
39
+ ```
40
+
41
+ Usage:
42
+
43
+ ```tsx
44
+ <TranslatedComponent id="greeting" key="greeting" /> & nbsp
45
+ <TranslatedComponent id="farewell" key="farewell" />
46
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@furystack/shades-i18n",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "I18n translation package and components for Shades",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "homepage": "https://github.com/furystack/furystack",
37
37
  "dependencies": {
38
- "@furystack/i18n": "^1.0.11",
39
- "@furystack/inject": "^12.0.15",
40
- "@furystack/shades": "^11.0.19"
38
+ "@furystack/i18n": "^1.0.13",
39
+ "@furystack/inject": "^12.0.17",
40
+ "@furystack/shades": "^11.0.21"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/node": "^22.15.17",
43
+ "@types/node": "^24.0.1",
44
44
  "typescript": "^5.8.3",
45
- "vitest": "^3.1.3"
45
+ "vitest": "^3.2.3"
46
46
  },
47
47
  "gitHead": "1045d854bfd8c475b7035471d130d401417a2321"
48
48
  }