@asafarim/shared-i18n 0.6.6 → 0.8.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.
Files changed (80) hide show
  1. package/demo/dist/Icon Dropdown_Limited Languages.png +0 -0
  2. package/demo/dist/Select Dropdown_Text Only.png +0 -0
  3. package/demo/dist/assets/favicon-BZYZvBLo.svg +4 -0
  4. package/demo/dist/assets/index-BdjqKw_N.css +1 -0
  5. package/demo/dist/assets/index-C1Tq1uEr.js +191 -0
  6. package/demo/dist/favicon.svg +4 -0
  7. package/demo/dist/index.html +27 -0
  8. package/demo/dist/logo.svg +24 -0
  9. package/demo/node_modules/.bin/browserslist +21 -0
  10. package/demo/node_modules/.bin/browserslist.CMD +12 -0
  11. package/demo/node_modules/.bin/browserslist.ps1 +41 -0
  12. package/demo/node_modules/.bin/tsc +4 -4
  13. package/demo/node_modules/.bin/tsc.CMD +12 -0
  14. package/demo/node_modules/.bin/tsc.ps1 +41 -0
  15. package/demo/node_modules/.bin/tsserver +4 -4
  16. package/demo/node_modules/.bin/tsserver.CMD +12 -0
  17. package/demo/node_modules/.bin/tsserver.ps1 +41 -0
  18. package/demo/node_modules/.bin/vite +4 -4
  19. package/demo/node_modules/.bin/vite.CMD +12 -0
  20. package/demo/node_modules/.bin/vite.ps1 +41 -0
  21. package/demo/node_modules/.vite/deps/@asafarim_country-language-selector.js +848 -0
  22. package/demo/node_modules/.vite/deps/@asafarim_country-language-selector.js.map +7 -0
  23. package/demo/node_modules/.vite/deps/_metadata.json +76 -0
  24. package/demo/node_modules/.vite/deps/chunk-5WRI5ZAA.js +30 -0
  25. package/demo/node_modules/.vite/deps/chunk-5WRI5ZAA.js.map +7 -0
  26. package/demo/node_modules/.vite/deps/chunk-B3AHR5EX.js +1004 -0
  27. package/demo/node_modules/.vite/deps/chunk-B3AHR5EX.js.map +7 -0
  28. package/demo/node_modules/.vite/deps/chunk-E6BG6WAU.js +292 -0
  29. package/demo/node_modules/.vite/deps/chunk-E6BG6WAU.js.map +7 -0
  30. package/demo/node_modules/.vite/deps/chunk-MVARZQEG.js +280 -0
  31. package/demo/node_modules/.vite/deps/chunk-MVARZQEG.js.map +7 -0
  32. package/demo/node_modules/.vite/deps/i18next-browser-languagedetector.js +400 -0
  33. package/demo/node_modules/.vite/deps/i18next-browser-languagedetector.js.map +7 -0
  34. package/demo/node_modules/.vite/deps/i18next.js +2392 -0
  35. package/demo/node_modules/.vite/deps/i18next.js.map +7 -0
  36. package/demo/node_modules/.vite/deps/package.json +3 -0
  37. package/demo/node_modules/.vite/deps/react-dom.js +6 -0
  38. package/demo/node_modules/.vite/deps/react-dom.js.map +7 -0
  39. package/demo/node_modules/.vite/deps/react-dom_client.js +20217 -0
  40. package/demo/node_modules/.vite/deps/react-dom_client.js.map +7 -0
  41. package/demo/node_modules/.vite/deps/react-i18next.js +869 -0
  42. package/demo/node_modules/.vite/deps/react-i18next.js.map +7 -0
  43. package/demo/node_modules/.vite/deps/react.js +5 -0
  44. package/demo/node_modules/.vite/deps/react.js.map +7 -0
  45. package/demo/node_modules/.vite/deps/react_jsx-dev-runtime.js +278 -0
  46. package/demo/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
  47. package/demo/node_modules/.vite/deps/react_jsx-runtime.js +6 -0
  48. package/demo/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
  49. package/demo/package.json +27 -24
  50. package/demo/public/favicon.svg +4 -4
  51. package/demo/public/logo.svg +24 -24
  52. package/demo/src/App.tsx +129 -116
  53. package/demo/src/components/CountryLanguageDemo.tsx +140 -0
  54. package/demo/src/components/GetStartedSection.tsx +56 -56
  55. package/demo/src/components/KeyTable.tsx +29 -29
  56. package/demo/src/components/LanguageBar.tsx +102 -18
  57. package/demo/src/components/LanguageSwitcherDemo.module.css +114 -113
  58. package/demo/src/components/LanguageSwitcherDemo.tsx +256 -202
  59. package/demo/src/components/Logo.tsx +6 -6
  60. package/demo/src/components/OverviewSection.tsx +43 -43
  61. package/demo/src/components/Panel.tsx +15 -15
  62. package/demo/src/components/StatusCard.tsx +109 -109
  63. package/demo/src/index.css +644 -605
  64. package/demo/src/locales/de/demo.json +85 -0
  65. package/demo/src/locales/en/demo.json +85 -85
  66. package/demo/src/locales/fr/demo.json +85 -85
  67. package/demo/src/locales/it/demo.json +85 -0
  68. package/demo/src/locales/nl/demo.json +85 -85
  69. package/demo/src/main.tsx +29 -24
  70. package/demo/tsconfig.json +18 -18
  71. package/demo/tsconfig.node.json +10 -10
  72. package/demo/tsconfig.tsbuildinfo +1 -1
  73. package/demo/vite-env.d.ts +7 -7
  74. package/demo/vite.config.d.ts +2 -2
  75. package/demo/vite.config.js +10 -10
  76. package/dist/components/LanguageSwitcher.module.css +303 -303
  77. package/dist/locales/de/common.json +68 -0
  78. package/dist/locales/it/common.json +68 -0
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +85 -84
@@ -0,0 +1,85 @@
1
+ {
2
+ "title": "Shared i18n Demo",
3
+ "subtitle": "Ein leichtgewichtiger React i18next Wrapper mit Cookie-Persistenz.",
4
+ "cta": "Sprache wechseln",
5
+ "overview": {
6
+ "heading": "Übersicht",
7
+ "description": "@asafarim/shared-i18n ist ein produktionsreifes Internationalisierungspaket (i18n) für React-Anwendungen.",
8
+ "features": {
9
+ "title": "Hauptmerkmale",
10
+ "items": [
11
+ "Mehrsprachiger Support mit Cookie-Persistenz",
12
+ "Eingebaute Spracherkennung und Fallback",
13
+ "TypeScript-Support mit vollständiger Typsicherheit",
14
+ "Vorkonfiguriert mit gemeinsamen und Identity-Portal-Namespaces",
15
+ "Nahtlose Integration mit react-i18next",
16
+ "Backend-Sprachpräferenz-Synchronisation",
17
+ "SSR-sichere Dienstprogramme für serverseitiges Rendering"
18
+ ]
19
+ },
20
+ "useCases": {
21
+ "title": "Perfekt für",
22
+ "items": [
23
+ "Globale Anwendungen, die mehrsprachigen Support benötigen",
24
+ "Enterprise-Plattformen mit Benutzer-Sprachpräferenzen",
25
+ "Identitäts- und Authentifizierungssysteme",
26
+ "Content-Management-Systeme mit Lokalisierung",
27
+ "SaaS-Anwendungen, die internationale Benutzer bedienen"
28
+ ]
29
+ }
30
+ },
31
+ "getStarted": {
32
+ "heading": "Erste Schritte",
33
+ "intro": "Erfahren Sie, wie Sie @asafarim/shared-i18n in wenigen Minuten in Ihre React-Anwendung integrieren.",
34
+ "steps": [
35
+ {
36
+ "title": "1. Paket installieren",
37
+ "description": "Fügen Sie das Paket zu Ihren Projektabhängigkeiten hinzu.",
38
+ "code": "pnpm add @asafarim/shared-i18n"
39
+ },
40
+ {
41
+ "title": "2. i18n in Ihrer App initialisieren",
42
+ "description": "Rufen Sie initI18n beim Anwendungsstart auf, um Spracheinstellungen zu konfigurieren.",
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. Den useLanguage Hook verwenden",
47
+ "description": "Greifen Sie auf Sprachwechsel und aktuellen Sprachstatus in Ihren Komponenten zu.",
48
+ "code": "const { changeLanguage, isChanging } = useLanguage();\n\n<button onClick={() => changeLanguage('nl')}>\n Zu Niederländisch wechseln\n</button>"
49
+ },
50
+ {
51
+ "title": "4. Mit useTranslation übersetzen",
52
+ "description": "Verwenden Sie den useTranslation Hook, um auf übersetzte Zeichenfolgen zuzugreifen.",
53
+ "code": "const { t } = useTranslation('common');\n\n<h1>{t('welcome')}</h1>"
54
+ },
55
+ {
56
+ "title": "5. Cookie-Persistenz nutzen",
57
+ "description": "Benutzer-Sprachpräferenzen werden automatisch gespeichert und wiederhergestellt.",
58
+ "code": "// Automatisch über Cookies persistiert\n// Keine zusätzliche Einrichtung erforderlich!"
59
+ },
60
+ {
61
+ "title": "6. Mit Backend synchronisieren (Optional)",
62
+ "description": "Aktualisieren Sie Benutzer-Sprachpräferenzen auf Ihrem Backend.",
63
+ "code": "import { updateUserLanguagePreference } from '@asafarim/shared-i18n';\n\nawait updateUserLanguagePreference('en');"
64
+ }
65
+ ],
66
+ "tips": {
67
+ "title": "Pro-Tipps",
68
+ "items": [
69
+ "Verwenden Sie Namespaces, um Übersetzungen nach Funktionen zu organisieren",
70
+ "Nutzen Sie die Trans-Komponente für komplexe Übersetzungen mit Variablen",
71
+ "Setzen Sie VITE_IDENTITY_API_URL für Backend-Synchronisation",
72
+ "Überprüfen Sie die Browser-Spracherkennung mit getInitialLanguage()",
73
+ "Kombinieren Sie mit Design-Tokens für konsistente Themen über Sprachen hinweg"
74
+ ]
75
+ }
76
+ },
77
+ "status": {
78
+ "heading": "Live-Status",
79
+ "cookie": "Cookie",
80
+ "backend": "Backend",
81
+ "simulate": "Backend-Synchronisation simulieren",
82
+ "resultOk": "Backend-Synchronisation erfolgreich",
83
+ "resultFail": "Backend-Synchronisation fehlgeschlagen"
84
+ }
85
+ }
@@ -1,85 +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
- }
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
+ }
@@ -1,85 +1,85 @@
1
- {
2
- "title": "Démonstration Shared i18n",
3
- "subtitle": "Un wrapper React i18next léger avec persistance des cookies.",
4
- "cta": "Changer de langue",
5
- "overview": {
6
- "heading": "Aperçu",
7
- "description": "@asafarim/shared-i18n est un package d'internationalisation (i18n) de qualité production pour les applications React.",
8
- "features": {
9
- "title": "Fonctionnalités Principales",
10
- "items": [
11
- "Support multi-langues avec persistance des cookies",
12
- "Détection de langue et fallback intégrés",
13
- "Support TypeScript avec sécurité typage complet",
14
- "Espaces de noms common et identity-portal préconfigurés",
15
- "Intégration transparente avec react-i18next",
16
- "Synchronisation des préférences de langue avec le backend",
17
- "Utilitaires SSR-safe pour le rendu côté serveur"
18
- ]
19
- },
20
- "useCases": {
21
- "title": "Idéal Pour",
22
- "items": [
23
- "Applications globales nécessitant un support multi-langues",
24
- "Plateformes enterprise avec préférences de langue utilisateur",
25
- "Systèmes d'identité et d'authentification",
26
- "Systèmes de gestion de contenu avec localisation",
27
- "Applications SaaS servant des utilisateurs internationaux"
28
- ]
29
- }
30
- },
31
- "getStarted": {
32
- "heading": "Premiers Pas",
33
- "intro": "Apprenez à intégrer @asafarim/shared-i18n dans votre application React en quelques minutes.",
34
- "steps": [
35
- {
36
- "title": "1. Installer le Package",
37
- "description": "Ajoutez le package aux dépendances de votre projet.",
38
- "code": "pnpm add @asafarim/shared-i18n"
39
- },
40
- {
41
- "title": "2. Initialiser i18n dans Votre App",
42
- "description": "Appelez initI18n au démarrage de l'application pour configurer les paramètres de langue.",
43
- "code": "import { initI18n } from '@asafarim/shared-i18n';\n\ninitI18n({\n defaultNS: 'common',\n ns: ['common', 'identityPortal'],\n resources: /* vos traductions */\n});"
44
- },
45
- {
46
- "title": "3. Utiliser le Hook useLanguage",
47
- "description": "Accédez au changement de langue et à l'état de langue actuel dans vos composants.",
48
- "code": "const { changeLanguage, isChanging } = useLanguage();\n\n<button onClick={() => changeLanguage('en')}>\n Vers Anglais\n</button>"
49
- },
50
- {
51
- "title": "4. Traduire avec useTranslation",
52
- "description": "Utilisez le hook useTranslation pour accéder aux chaînes traduites.",
53
- "code": "const { t } = useTranslation('common');\n\n<h1>{t('welcome')}</h1>"
54
- },
55
- {
56
- "title": "5. Profiter de la Persistance des Cookies",
57
- "description": "Les préférences de langue des utilisateurs sont automatiquement sauvegardées et restaurées.",
58
- "code": "// Sauvegardé automatiquement via cookies\n// Aucune configuration supplémentaire requise !"
59
- },
60
- {
61
- "title": "6. Synchroniser avec le Backend (Optionnel)",
62
- "description": "Mettez à jour les préférences de langue des utilisateurs sur votre backend.",
63
- "code": "import { updateUserLanguagePreference } from '@asafarim/shared-i18n';\n\nawait updateUserLanguagePreference('fr');"
64
- }
65
- ],
66
- "tips": {
67
- "title": "Conseils Pro",
68
- "items": [
69
- "Utilisez les espaces de noms pour organiser les traductions par fonctionnalité",
70
- "Profitez du composant Trans pour les traductions complexes avec variables",
71
- "Configurez VITE_IDENTITY_API_URL pour la synchronisation backend",
72
- "Vérifiez la détection de langue du navigateur avec getInitialLanguage()",
73
- "Combinez avec les design tokens pour des thèmes cohérents dans toutes les langues"
74
- ]
75
- }
76
- },
77
- "status": {
78
- "heading": "Statut en direct",
79
- "cookie": "Cookie",
80
- "backend": "Backend",
81
- "simulate": "Simuler la synchronisation backend",
82
- "resultOk": "Synchronisation backend réussie",
83
- "resultFail": "Échec de la synchronisation backend"
84
- }
85
- }
1
+ {
2
+ "title": "Démonstration Shared i18n",
3
+ "subtitle": "Un wrapper React i18next léger avec persistance des cookies.",
4
+ "cta": "Changer de langue",
5
+ "overview": {
6
+ "heading": "Aperçu",
7
+ "description": "@asafarim/shared-i18n est un package d'internationalisation (i18n) de qualité production pour les applications React.",
8
+ "features": {
9
+ "title": "Fonctionnalités Principales",
10
+ "items": [
11
+ "Support multi-langues avec persistance des cookies",
12
+ "Détection de langue et fallback intégrés",
13
+ "Support TypeScript avec sécurité typage complet",
14
+ "Espaces de noms common et identity-portal préconfigurés",
15
+ "Intégration transparente avec react-i18next",
16
+ "Synchronisation des préférences de langue avec le backend",
17
+ "Utilitaires SSR-safe pour le rendu côté serveur"
18
+ ]
19
+ },
20
+ "useCases": {
21
+ "title": "Idéal Pour",
22
+ "items": [
23
+ "Applications globales nécessitant un support multi-langues",
24
+ "Plateformes enterprise avec préférences de langue utilisateur",
25
+ "Systèmes d'identité et d'authentification",
26
+ "Systèmes de gestion de contenu avec localisation",
27
+ "Applications SaaS servant des utilisateurs internationaux"
28
+ ]
29
+ }
30
+ },
31
+ "getStarted": {
32
+ "heading": "Premiers Pas",
33
+ "intro": "Apprenez à intégrer @asafarim/shared-i18n dans votre application React en quelques minutes.",
34
+ "steps": [
35
+ {
36
+ "title": "1. Installer le Package",
37
+ "description": "Ajoutez le package aux dépendances de votre projet.",
38
+ "code": "pnpm add @asafarim/shared-i18n"
39
+ },
40
+ {
41
+ "title": "2. Initialiser i18n dans Votre App",
42
+ "description": "Appelez initI18n au démarrage de l'application pour configurer les paramètres de langue.",
43
+ "code": "import { initI18n } from '@asafarim/shared-i18n';\n\ninitI18n({\n defaultNS: 'common',\n ns: ['common', 'identityPortal'],\n resources: /* vos traductions */\n});"
44
+ },
45
+ {
46
+ "title": "3. Utiliser le Hook useLanguage",
47
+ "description": "Accédez au changement de langue et à l'état de langue actuel dans vos composants.",
48
+ "code": "const { changeLanguage, isChanging } = useLanguage();\n\n<button onClick={() => changeLanguage('en')}>\n Vers Anglais\n</button>"
49
+ },
50
+ {
51
+ "title": "4. Traduire avec useTranslation",
52
+ "description": "Utilisez le hook useTranslation pour accéder aux chaînes traduites.",
53
+ "code": "const { t } = useTranslation('common');\n\n<h1>{t('welcome')}</h1>"
54
+ },
55
+ {
56
+ "title": "5. Profiter de la Persistance des Cookies",
57
+ "description": "Les préférences de langue des utilisateurs sont automatiquement sauvegardées et restaurées.",
58
+ "code": "// Sauvegardé automatiquement via cookies\n// Aucune configuration supplémentaire requise !"
59
+ },
60
+ {
61
+ "title": "6. Synchroniser avec le Backend (Optionnel)",
62
+ "description": "Mettez à jour les préférences de langue des utilisateurs sur votre backend.",
63
+ "code": "import { updateUserLanguagePreference } from '@asafarim/shared-i18n';\n\nawait updateUserLanguagePreference('fr');"
64
+ }
65
+ ],
66
+ "tips": {
67
+ "title": "Conseils Pro",
68
+ "items": [
69
+ "Utilisez les espaces de noms pour organiser les traductions par fonctionnalité",
70
+ "Profitez du composant Trans pour les traductions complexes avec variables",
71
+ "Configurez VITE_IDENTITY_API_URL pour la synchronisation backend",
72
+ "Vérifiez la détection de langue du navigateur avec getInitialLanguage()",
73
+ "Combinez avec les design tokens pour des thèmes cohérents dans toutes les langues"
74
+ ]
75
+ }
76
+ },
77
+ "status": {
78
+ "heading": "Statut en direct",
79
+ "cookie": "Cookie",
80
+ "backend": "Backend",
81
+ "simulate": "Simuler la synchronisation backend",
82
+ "resultOk": "Synchronisation backend réussie",
83
+ "resultFail": "Échec de la synchronisation backend"
84
+ }
85
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "title": "Demo i18n condiviso",
3
+ "subtitle": "Un wrapper leggero React i18next con persistenza dei cookie.",
4
+ "cta": "Cambia lingua",
5
+ "overview": {
6
+ "heading": "Panoramica",
7
+ "description": "@asafarim/shared-i18n è un pacchetto di internazionalizzazione (i18n) di livello produzione per applicazioni React.",
8
+ "features": {
9
+ "title": "Caratteristiche Principali",
10
+ "items": [
11
+ "Supporto multi-lingua con persistenza dei cookie",
12
+ "Rilevamento automatico della lingua e fallback",
13
+ "Supporto TypeScript con sicurezza completa dei tipi",
14
+ "Pre-configurato con namespace comuni e identity-portal",
15
+ "Integrazione perfetta con react-i18next",
16
+ "Sincronizzazione delle preferenze linguistiche del backend",
17
+ "Utilità sicure per SSR per il rendering lato server"
18
+ ]
19
+ },
20
+ "useCases": {
21
+ "title": "Perfetto Per",
22
+ "items": [
23
+ "Applicazioni globali che richiedono supporto multi-lingua",
24
+ "Piattaforme enterprise con preferenze linguistiche degli utenti",
25
+ "Sistemi di identità e autenticazione",
26
+ "Sistemi di gestione contenuti con localizzazione",
27
+ "Applicazioni SaaS che servono utenti internazionali"
28
+ ]
29
+ }
30
+ },
31
+ "getStarted": {
32
+ "heading": "Inizia",
33
+ "intro": "Scopri come integrare @asafarim/shared-i18n nella tua applicazione React in pochi minuti.",
34
+ "steps": [
35
+ {
36
+ "title": "1. Installa il Pacchetto",
37
+ "description": "Aggiungi il pacchetto alle dipendenze del tuo progetto.",
38
+ "code": "pnpm add @asafarim/shared-i18n"
39
+ },
40
+ {
41
+ "title": "2. Inizializza i18n nella Tua App",
42
+ "description": "Chiama initI18n all'avvio dell'applicazione per configurare le impostazioni linguistiche.",
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. Usa l'Hook useLanguage",
47
+ "description": "Accedi al cambio lingua e allo stato della lingua corrente nei tuoi componenti.",
48
+ "code": "const { changeLanguage, isChanging } = useLanguage();\n\n<button onClick={() => changeLanguage('nl')}>\n Passa all'olandese\n</button>"
49
+ },
50
+ {
51
+ "title": "4. Traduci con useTranslation",
52
+ "description": "Usa l'hook useTranslation per accedere alle stringhe tradotte.",
53
+ "code": "const { t } = useTranslation('common');\n\n<h1>{t('welcome')}</h1>"
54
+ },
55
+ {
56
+ "title": "5. Sfrutta la Persistenza dei Cookie",
57
+ "description": "Le preferenze linguistiche degli utenti vengono automaticamente salvate e ripristinate.",
58
+ "code": "// Automaticamente persistito tramite cookie\n// Nessuna configurazione aggiuntiva richiesta!"
59
+ },
60
+ {
61
+ "title": "6. Sincronizza con il Backend (Opzionale)",
62
+ "description": "Aggiorna le preferenze linguistiche degli utenti sul tuo backend.",
63
+ "code": "import { updateUserLanguagePreference } from '@asafarim/shared-i18n';\n\nawait updateUserLanguagePreference('en');"
64
+ }
65
+ ],
66
+ "tips": {
67
+ "title": "Suggerimenti Pro",
68
+ "items": [
69
+ "Usa i namespace per organizzare le traduzioni per funzionalità",
70
+ "Sfrutta il componente Trans per traduzioni complesse con variabili",
71
+ "Imposta VITE_IDENTITY_API_URL per la sincronizzazione del backend",
72
+ "Verifica il rilevamento della lingua del browser con getInitialLanguage()",
73
+ "Combina con i design token per un tema consistente tra le lingue"
74
+ ]
75
+ }
76
+ },
77
+ "status": {
78
+ "heading": "Stato live",
79
+ "cookie": "Cookie",
80
+ "backend": "Backend",
81
+ "simulate": "Simula sincronizzazione backend",
82
+ "resultOk": "Sincronizzazione backend riuscita",
83
+ "resultFail": "Sincronizzazione backend fallita"
84
+ }
85
+ }