1- import { BrowserModule } from '@angular/platform-browser' ;
2- import { NgModule } from '@angular/core' ;
3- import { HttpClient , provideHttpClient } from '@angular/common/http' ;
4- import { APP_BASE_HREF , CommonModule } from '@angular/common' ;
5- import { FormsModule , ReactiveFormsModule } from '@angular/forms' ; // <-- NgModel lives here
6- import { NGXLogger } from 'ngx-logger' ;
7- import { CookieService } from 'ngx-cookie-service' ;
8- import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
9- import { TranslateLoader , TranslateModule } from '@ngx-translate/core' ;
10- import { DragDropModule } from '@angular/cdk/drag-drop' ;
11- import { CodeEditorModule } from '@acrodata/code-editor' ;
1+ import { BrowserModule } from '@angular/platform-browser' ;
2+ import { NgModule } from '@angular/core' ;
3+ import { HttpClient , provideHttpClient } from '@angular/common/http' ;
4+ import { APP_BASE_HREF , CommonModule } from '@angular/common' ;
5+ import { FormsModule , ReactiveFormsModule } from '@angular/forms' ; // <-- NgModel lives here
6+ import { NGXLogger } from 'ngx-logger' ;
7+ import { CookieService } from 'ngx-cookie-service' ;
8+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
9+ import { TranslateLoader , TranslateModule } from '@ngx-translate/core' ;
10+ import { DragDropModule } from '@angular/cdk/drag-drop' ;
11+ import { CodeEditorModule } from '@acrodata/code-editor' ;
1212
1313// service
14- import { AllServices } from '@app/services' ;
14+ import { AllServices } from '@app/services' ;
1515
1616// Angular split
17- import { AppRouterModule } from './router.module' ;
18- import { SharedPipeModule } from './pipes/pipes' ;
19- import { AppComponent } from './pages/app.component' ;
20- import { ElementComponents } from './elements/elements.component' ;
21- import { PluginModules } from './plugins/plugins' ;
22- import { ClipboardService } from 'ngx-clipboard' ;
23- import { version } from '../environments/environment' ;
24- import { BehaviorSubject , forkJoin , Observable , of } from 'rxjs' ;
25- import { FileInputAccessorModule } from 'file-input-accessor' ;
26- import { catchError , mergeMap } from 'rxjs/operators' ;
27- import { PagesComponents } from './pages/pages.component' ;
28-
17+ import { AppRouterModule } from './router.module' ;
18+ import { SharedPipeModule } from './pipes/pipes' ;
19+ import { AppComponent } from './pages/app.component' ;
20+ import { ElementComponents } from './elements/elements.component' ;
21+ import { PluginModules } from './plugins/plugins' ;
22+ import { ClipboardService } from 'ngx-clipboard' ;
23+ import { environment , version } from '../environments/environment' ;
24+ import { BehaviorSubject , forkJoin , Observable , of } from 'rxjs' ;
25+ import { FileInputAccessorModule } from 'file-input-accessor' ;
26+ import { catchError , mergeMap } from 'rxjs/operators' ;
27+ import { PagesComponents } from './pages/pages.component' ;
2928
3029export class CustomLoader implements TranslateLoader {
31-
32- constructor ( private http : HttpClient ) {
33- }
30+ constructor ( private http : HttpClient ) { }
3431
3532 public getTranslation ( lang : String ) : Observable < any > {
3633 const remote = '/api/v1/settings/i18n/luna/?lang=' + lang + '&v=' + version ;
37- const local = '/luna/assets/i18n/' + lang + '.json' ;
34+ let local = '/assets/i18n/' + lang + '.json' ;
35+ const isProd = environment . production ;
36+ if ( isProd ) {
37+ local = '/luna' + local ;
38+ }
3839
3940 return forkJoin ( [
40- this . http . get ( remote ) . pipe (
41- catchError ( ( ) => of ( { } ) )
42- ) ,
43- this . http . get ( local ) . pipe (
44- catchError ( ( ) => of ( { } ) )
45- )
41+ this . http . get ( remote ) . pipe ( catchError ( ( ) => of ( { } ) ) ) ,
42+ this . http . get ( local ) . pipe ( catchError ( ( ) => of ( { } ) ) )
4643 ] ) . pipe (
47- mergeMap ( ( res ) => {
44+ mergeMap ( res => {
4845 const finalRes = Object . assign ( { } , res [ 1 ] , res [ 0 ] ) ;
4946 return new BehaviorSubject ( finalRes ) ;
5047 } )
@@ -71,22 +68,17 @@ export class CustomLoader implements TranslateLoader {
7168 deps : [ HttpClient ]
7269 }
7370 } ) ,
74- ...PluginModules ,
71+ ...PluginModules
7572 ] ,
76- declarations : [
77- AppComponent ,
78- ...ElementComponents ,
79- ...PagesComponents
80- ] as any [ ] ,
73+ declarations : [ AppComponent , ...ElementComponents , ...PagesComponents ] as any [ ] ,
8174 bootstrap : [ AppComponent ] ,
8275 providers : [
8376 ...AllServices ,
84- { provide : APP_BASE_HREF , useValue : '/luna/' } ,
77+ { provide : APP_BASE_HREF , useValue : '/luna/' } ,
8578 CookieService ,
8679 NGXLogger ,
8780 ClipboardService ,
8881 provideHttpClient ( )
8982 ]
9083} )
91- export class AppModule {
92- }
84+ export class AppModule { }
0 commit comments