@genrwork/laravel-i18next 0.1.0 → 0.1.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/package.json CHANGED
@@ -1,155 +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
- }
1
+ {
2
+ "name": "@genrwork/laravel-i18next",
3
+ "version": "0.1.1",
4
+ "description": "Use your Laravel translation files with i18next in React, Vue 3 or Svelte: PHP files are converted to i18next JSON at build time, 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
+ }
@@ -1,43 +0,0 @@
1
- import type { i18n, TOptions } from 'i18next';
2
- /**
3
- * i18next format plugin translating the way Laravel does:
4
- *
5
- * - flat keys (`auth.failed`, `Welcome, :name!`), no key or namespace separators;
6
- * - `:name`, `:NAME` and `:Name` replacements instead of `{{name}}` interpolation and `$t()` nesting;
7
- * - a numeric `count` selects the message with Laravel's `trans_choice()` rules
8
- * (`one|many`, `{0} none|[1,19] some|[20,*] many`) instead of `_one`/`_other` suffixed keys;
9
- * - empty messages fall back to the next language.
10
- */
11
- export default class LaravelFormat {
12
- static type: "i18nFormat";
13
- type: "i18nFormat";
14
- /**
15
- * Non-string translations (e.g. an empty PHP array) are returned as is.
16
- */
17
- handleAsObject: boolean;
18
- private i18next?;
19
- init(i18next: i18n): void;
20
- getResource(language: string, namespace: string, key: string): any;
21
- addLookupKeys(finalKeys: string[]): string[];
22
- parse(message: unknown, options: TOptions, language: string, namespace: string, _key?: string, info?: {
23
- resolved?: {
24
- usedLng?: string;
25
- };
26
- }): unknown;
27
- /**
28
- * The language the message actually resolved in, so pluralization always
29
- * matches the text being pluralized -- never merely a language that has
30
- * translations for the namespace, which is not the same thing once several
31
- * sources can contribute to one namespace (see LaravelBackend): a single
32
- * unrelated key from a higher-priority source is enough to make
33
- * `hasResourceBundle(language, namespace)` true for a namespace whose
34
- * actual message still came from the fallback language.
35
- *
36
- * i18next passes the language the lookup succeeded at as `resolved.usedLng`
37
- * in `parse()`'s 6th argument (`extendTranslation()` in i18next's own
38
- * `translator.js`); prefer it. Older i18next in the `>=24` peer range that
39
- * does not pass it falls back to a heuristic: the current language when it
40
- * has translations for the namespace, else the fallback language.
41
- */
42
- private getPluralLocale;
43
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Placeholder replacements, e.g. `{ name: 'Francisco' }` for `:name`.
3
- */
4
- export default interface ReplacementsInterface {
5
- [key: string]: string | number;
6
- }
@@ -1,9 +0,0 @@
1
- import type ReplacementsInterface from '../interfaces/replacements';
2
- /**
3
- * Make the place-holder replacements on a line, the Laravel way:
4
- * `:name` as is, `:NAME` upper-cased and `:Name` capitalized.
5
- *
6
- * @param message
7
- * @param replacements
8
- */
9
- export default function replacer(message: string, replacements?: ReplacementsInterface): string;
File without changes