@@ -20,22 +20,19 @@ import { AppComponent } from './pages/app.component';
2020import { ElementComponents } from './elements/elements.component' ;
2121import { PluginModules } from './plugins/plugins' ;
2222import { ClipboardService } from 'ngx-clipboard' ;
23- import { environment , version } from '../environments/environment' ;
23+ import { version } from '../environments/environment' ;
2424import { BehaviorSubject , forkJoin , Observable , of } from 'rxjs' ;
2525import { FileInputAccessorModule } from 'file-input-accessor' ;
2626import { catchError , mergeMap } from 'rxjs/operators' ;
2727import { PagesComponents } from './pages/pages.component' ;
28+ import { getAppBasePath , withAppBase , withSitePrefix } from '@app/utils/path' ;
2829
2930export class CustomLoader implements TranslateLoader {
3031 constructor ( private http : HttpClient ) { }
3132
3233 public getTranslation ( lang : String ) : Observable < any > {
33- const remote = '/api/v1/settings/i18n/luna/?lang=' + lang + '&v=' + version ;
34- let local = '/assets/i18n/' + lang + '.json' ;
35- const isProd = environment . production ;
36- if ( isProd ) {
37- local = '/luna' + local ;
38- }
34+ const remote = withSitePrefix ( '/api/v1/settings/i18n/luna/?lang=' + lang + '&v=' + version ) ;
35+ const local = withAppBase ( '/assets/i18n/' + lang + '.json' ) ;
3936
4037 return forkJoin ( [
4138 this . http . get ( remote ) . pipe ( catchError ( ( ) => of ( { } ) ) ) ,
@@ -74,7 +71,7 @@ export class CustomLoader implements TranslateLoader {
7471 bootstrap : [ AppComponent ] ,
7572 providers : [
7673 ...AllServices ,
77- { provide : APP_BASE_HREF , useValue : '/luna/' } ,
74+ { provide : APP_BASE_HREF , useFactory : getAppBasePath } ,
7875 CookieService ,
7976 NGXLogger ,
8077 ClipboardService ,
0 commit comments