File tree Expand file tree Collapse file tree 6 files changed +11
-35
lines changed
Expand file tree Collapse file tree 6 files changed +11
-35
lines changed Original file line number Diff line number Diff line change @@ -38,17 +38,6 @@ php artisan kui-fortify:install blade # This command will publish laravel/fortif
3838
3939# then
4040npm install && npm run dev # or yarn && yarn dev
41-
42- # Laravel mix will compile successfully, but with 1 warning `Module not found: Error: Can't resolve '../../lang'`.
43- # It will work but you can fix it by remove trycatch in `app.js` and import lang file like this:
44-
45- # laravel 9
46- # resolve: (lang) => import(`../../lang/${lang}.json`),
47-
48- # laravel < 9
49- # resolve: (lang) => import(`../lang/${lang}.json`),
50-
51- # Until we fix it.
5241```
5342
54434 . Configure your database.
Original file line number Diff line number Diff line change @@ -235,9 +235,11 @@ protected function installVue()
235235 );
236236
237237 // Lang File
238- if ((new Filesystem )->exists (resource_path ('lang ' ))) {
238+ if ((new Filesystem )->exists (resource_path ('lang ' ))) { // Laravel < 9
239239 copy (__DIR__ . '/../../stubs/vue/lang/ar.json ' , resource_path ('lang/ar.json ' ));
240- } else if ((new Filesystem )->exists (base_path ('lang ' ))) {
240+ copy (__DIR__ . '/../../stubs/vue/lang/en.json ' , resource_path ('lang/en.json ' ));
241+ } else if ((new Filesystem )->exists (base_path ('lang ' ))) { // Laravel 9
242+ $ this ->replaceInFile ('../lang ' , '../../lang ' , resource_path ('js/app.js ' ));
241243 copy (__DIR__ . '/../../stubs/vue/lang/ar.json ' , base_path ('lang/ar.json ' ));
242244 }
243245
Original file line number Diff line number Diff line change 1- {}
1+ {
2+ "Dashboard" : " لوحة التحكم"
3+ }
Original file line number Diff line number Diff line change 1+ {
2+ "Dashboard" : " Dashboard"
3+ }
Original file line number Diff line number Diff line change @@ -5,11 +5,6 @@ import { createInertiaApp } from '@inertiajs/inertia-vue3';
55import { InertiaProgress } from '@inertiajs/progress' ;
66import { i18nVue } from 'laravel-vue-i18n' ;
77import Toast from 'vue-toastification' ;
8- import composer from '../../composer.json' ;
9-
10- const isLaravel9 = composer . require [ "laravel/framework" ] . startsWith ( "^9." )
11- ? true
12- : false ;
138
149const appName =
1510 window . document . getElementsByTagName ( 'title' ) [ 0 ] ?. innerText || 'Laravel' ;
@@ -21,18 +16,7 @@ createInertiaApp({
2116 return createApp ( { render : ( ) => h ( app , props ) } )
2217 . use ( plugin )
2318 . use ( i18nVue , {
24- // TODO: Use a real solution.
25- resolve : ( lang ) => {
26- if ( isLaravel9 ) {
27- try {
28- return import ( `../../lang/${ lang } .json` ) ;
29- } catch ( error ) { }
30- } else {
31- try {
32- return import ( `../lang/${ lang } .json` ) ;
33- } catch ( error ) { }
34- }
35- } ,
19+ resolve : ( lang ) => import ( `../lang/${ lang } .json` ) ,
3620 } )
3721 . use ( Toast , {
3822 hideProgressBar : true ,
Original file line number Diff line number Diff line change 2121 </head >
2222 <body class =" font-sans antialiased" >
2323 @inertia
24-
25- @env (' local' )
26- <script src =" http://localhost:8080/js/bundle.js" ></script >
27- @endenv
2824 </body >
2925</html >
You can’t perform that action at this time.
0 commit comments