@genrwork/laravel-i18next 0.1.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.

Potentially problematic release.


This version of @genrwork/laravel-i18next might be problematic. Click here for more details.

Files changed (38) hide show
  1. package/README.md +367 -0
  2. package/client.d.ts +12 -0
  3. package/dist/index.cjs +12 -0
  4. package/dist/index.mjs +2 -0
  5. package/dist/react.cjs +40 -0
  6. package/dist/react.mjs +38 -0
  7. package/dist/shared/create-i18n-BSEwKsCX.mjs +641 -0
  8. package/dist/shared/create-i18n-WsDK4Z8L.cjs +647 -0
  9. package/dist/svelte.cjs +77 -0
  10. package/dist/svelte.mjs +74 -0
  11. package/dist/types/backend.d.ts +29 -0
  12. package/dist/types/contrib/get-plural-index.d.ts +15 -0
  13. package/dist/types/format.d.ts +43 -0
  14. package/dist/types/index.d.ts +7 -0
  15. package/dist/types/interfaces/locale-file.d.ts +8 -0
  16. package/dist/types/interfaces/options.d.ts +19 -0
  17. package/dist/types/interfaces/replacements.d.ts +6 -0
  18. package/dist/types/plugin/helper.d.ts +6 -0
  19. package/dist/types/plugin/locale.d.ts +11 -0
  20. package/dist/types/plugin/parser.d.ts +22 -0
  21. package/dist/types/plugin/sources.d.ts +53 -0
  22. package/dist/types/react/i18n-provider-props.d.ts +23 -0
  23. package/dist/types/react/index.d.ts +3 -0
  24. package/dist/types/react/provider.d.ts +10 -0
  25. package/dist/types/shared/create-i18n.d.ts +26 -0
  26. package/dist/types/svelte/index.d.ts +48 -0
  27. package/dist/types/utils/pluralization.d.ts +9 -0
  28. package/dist/types/utils/recognizer.d.ts +29 -0
  29. package/dist/types/utils/replacer.d.ts +9 -0
  30. package/dist/types/utils/resolver.d.ts +23 -0
  31. package/dist/types/utils/sources.d.ts +14 -0
  32. package/dist/types/vite.d.ts +25 -0
  33. package/dist/types/vue/index.d.ts +21 -0
  34. package/dist/vite.cjs +315 -0
  35. package/dist/vite.mjs +310 -0
  36. package/dist/vue.cjs +39 -0
  37. package/dist/vue.mjs +34 -0
  38. package/package.json +155 -0
package/dist/vue.mjs ADDED
@@ -0,0 +1,34 @@
1
+ import I18NextVue from 'i18next-vue';
2
+ export { useTranslation } from 'i18next-vue';
3
+ import { c as createI18n, s as syncDocumentLang } from './shared/create-i18n-BSEwKsCX.mjs';
4
+ import 'i18next';
5
+
6
+ /**
7
+ * Vue plugin providing an i18next instance translating Laravel language files
8
+ * to `i18next-vue`'s `useTranslation()` composable and `$t`/`$i18next`.
9
+ *
10
+ * Every app instance owns its own i18next instance, so concurrent SSR requests
11
+ * do not share a language.
12
+ *
13
+ * ```ts
14
+ * import { createApp } from 'vue';
15
+ * import { laravelVueI18n } from '@genrwork/laravel-i18next/vue';
16
+ *
17
+ * createApp(App)
18
+ * .use(laravelVueI18n({ locale: 'uk', fallbackLocale: 'en', files: import.meta.glob('/lang/**\/*.json') }))
19
+ * .mount('#app');
20
+ * ```
21
+ */ function laravelVueI18n(options) {
22
+ return {
23
+ install (app) {
24
+ const i18next = createI18n(options);
25
+ // Lives for the app's lifetime, so it is never unsubscribed.
26
+ syncDocumentLang(i18next);
27
+ app.use(I18NextVue, {
28
+ i18next
29
+ });
30
+ }
31
+ };
32
+ }
33
+
34
+ export { laravelVueI18n };
package/package.json ADDED
@@ -0,0 +1,155 @@
1
+ {
2
+ "name": "@genrwork/laravel-i18next",
3
+ "version": "0.1.0",
4
+ "description": "Use your Laravel translation files with i18next in React, Vue 3 or Svelte: i18next plugins translating like Laravel, one namespace per language file.",
5
+ "keywords": [
6
+ "laravel",
7
+ "react",
8
+ "vue",
9
+ "svelte",
10
+ "i18n",
11
+ "i18next",
12
+ "i18next-backend",
13
+ "react-i18next",
14
+ "i18next-vue",
15
+ "inertiajs",
16
+ "vite-plugin",
17
+ "vite-plugin-laravel"
18
+ ],
19
+ "sideEffects": false,
20
+ "main": "./dist/index.cjs",
21
+ "module": "./dist/index.mjs",
22
+ "types": "./dist/types/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/types/index.d.ts",
26
+ "import": "./dist/index.mjs",
27
+ "require": "./dist/index.cjs"
28
+ },
29
+ "./react": {
30
+ "types": "./dist/types/react/index.d.ts",
31
+ "import": "./dist/react.mjs",
32
+ "require": "./dist/react.cjs"
33
+ },
34
+ "./vue": {
35
+ "types": "./dist/types/vue/index.d.ts",
36
+ "import": "./dist/vue.mjs",
37
+ "require": "./dist/vue.cjs"
38
+ },
39
+ "./svelte": {
40
+ "types": "./dist/types/svelte/index.d.ts",
41
+ "import": "./dist/svelte.mjs",
42
+ "require": "./dist/svelte.cjs"
43
+ },
44
+ "./vite": {
45
+ "types": "./dist/types/vite.d.ts",
46
+ "import": "./dist/vite.mjs",
47
+ "require": "./dist/vite.cjs"
48
+ },
49
+ "./client": {
50
+ "types": "./client.d.ts"
51
+ },
52
+ "./package.json": "./package.json"
53
+ },
54
+ "typesVersions": {
55
+ "*": {
56
+ "react": [
57
+ "./dist/types/react/index.d.ts"
58
+ ],
59
+ "vue": [
60
+ "./dist/types/vue/index.d.ts"
61
+ ],
62
+ "svelte": [
63
+ "./dist/types/svelte/index.d.ts"
64
+ ],
65
+ "vite": [
66
+ "./dist/types/vite.d.ts"
67
+ ],
68
+ "client": [
69
+ "./client.d.ts"
70
+ ]
71
+ }
72
+ },
73
+ "repository": "genrwork/js-modules",
74
+ "bugs": {
75
+ "url": "https://github.com/genrwork/js-modules/issues"
76
+ },
77
+ "author": {
78
+ "name": "genrwork",
79
+ "email": "contact@genrwork.com"
80
+ },
81
+ "license": "MIT",
82
+ "files": [
83
+ "dist",
84
+ "client.d.ts"
85
+ ],
86
+ "scripts": {
87
+ "build": "rollup -c",
88
+ "dev": "rollup -c -w",
89
+ "test": "vitest run",
90
+ "typecheck": "tsc -p tsconfig.test.json",
91
+ "prepack": "npm run typecheck && npm test && npm run build"
92
+ },
93
+ "engines": {
94
+ "node": ">=18"
95
+ },
96
+ "dependencies": {
97
+ "php-array-reader": "^2.1.4"
98
+ },
99
+ "peerDependencies": {
100
+ "i18next": ">=24.0.0",
101
+ "i18next-vue": ">=5.0.0",
102
+ "react": "^18.0.0 || ^19.0.0",
103
+ "react-i18next": ">=15.0.0",
104
+ "svelte": "^4.0.0 || ^5.0.0",
105
+ "vite": ">=5.0.0",
106
+ "vue": "^3.4.38"
107
+ },
108
+ "peerDependenciesMeta": {
109
+ "i18next-vue": {
110
+ "optional": true
111
+ },
112
+ "react": {
113
+ "optional": true
114
+ },
115
+ "react-i18next": {
116
+ "optional": true
117
+ },
118
+ "svelte": {
119
+ "optional": true
120
+ },
121
+ "vite": {
122
+ "optional": true
123
+ },
124
+ "vue": {
125
+ "optional": true
126
+ }
127
+ },
128
+ "devDependencies": {
129
+ "@inertiajs/react": "^3.7.1",
130
+ "@rollup/plugin-swc": "^0.4.1",
131
+ "@rollup/plugin-typescript": "^12.3.0",
132
+ "@sveltejs/vite-plugin-svelte": "^7.3.0",
133
+ "@swc/core": "^1.16.2",
134
+ "@testing-library/react": "^16.3.3",
135
+ "@testing-library/svelte": "^5.4.2",
136
+ "@types/node": "^22.20.3",
137
+ "@types/react": "^19.3.0",
138
+ "@types/react-dom": "^19.3.0",
139
+ "@vitejs/plugin-vue": "^6.0.9",
140
+ "@vue/test-utils": "^2.5.1",
141
+ "i18next": "^26.4.2",
142
+ "i18next-vue": "^5.4.0",
143
+ "inertia-react-v2": "npm:@inertiajs/react@^2.3.28",
144
+ "jsdom": "^29.1.1",
145
+ "react": "^19.3.0",
146
+ "react-dom": "^19.3.0",
147
+ "react-i18next": "^17.0.14",
148
+ "rollup": "^4.63.3",
149
+ "svelte": "^5.57.0",
150
+ "typescript": "~5.9",
151
+ "vite": "^8.3.0",
152
+ "vitest": "^5.0.1",
153
+ "vue": "^3.5.42"
154
+ }
155
+ }