Use browser language
This commit is contained in:
parent
f38dbd3b2f
commit
a020068d36
|
@ -3,7 +3,6 @@ import { AuthService } from './_services/auth.service';
|
|||
import { LocationBackService } from 'src/app/_services/locationBack.service';
|
||||
import { versions } from 'src/environments/versions';
|
||||
import { Router, RouteConfigLoadStart, RouteConfigLoadEnd } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
@ -19,12 +18,9 @@ export class AppComponent {
|
|||
constructor(
|
||||
public auth: AuthService,
|
||||
private locationBackService: LocationBackService,
|
||||
private router: Router,
|
||||
private translate: TranslateService
|
||||
private router: Router
|
||||
) {
|
||||
this.revision_datetime_string = new Date(versions.revision_timestamp).toLocaleString(undefined, { day: '2-digit', month: '2-digit', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' });
|
||||
this.translate.setDefaultLang('en');
|
||||
this.translate.use("it");
|
||||
}
|
||||
|
||||
ngOnInit () {
|
||||
|
|
|
@ -5,6 +5,7 @@ import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common
|
|||
import { FormsModule } from '@angular/forms';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { TranslationModule } from './translation.module';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { ModalModule } from 'ngx-bootstrap/modal';
|
||||
import { TooltipModule } from 'ngx-bootstrap/tooltip';
|
||||
|
@ -68,7 +69,8 @@ import { AuthInterceptor } from './_providers/auth-interceptor.provider';
|
|||
useFactory: HttpLoaderFactory,
|
||||
deps: [HttpClient]
|
||||
}
|
||||
})
|
||||
}),
|
||||
TranslationModule
|
||||
],
|
||||
providers: [{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
|
|
|
@ -9,8 +9,8 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|||
]
|
||||
})
|
||||
export class TranslationModule {
|
||||
constructor(private translate: TranslateService) {
|
||||
this.translate.setDefaultLang('en');
|
||||
this.translate.use("it");
|
||||
}
|
||||
constructor(private translate: TranslateService) {
|
||||
this.translate.setDefaultLang('en');
|
||||
this.translate.use(window.navigator.language.split("-")[0]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue