mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-04 22:13:36 +00:00
fix(console): fallback to default language if browser language not supported (#5999)
fix: fallback to default language if browser language not supported
This commit is contained in:
@@ -8,6 +8,7 @@ import { catchError, switchMap, tap, throwError } from 'rxjs';
|
||||
import { AdminServiceClient } from '../proto/generated/zitadel/AdminServiceClientPb';
|
||||
import { AuthServiceClient } from '../proto/generated/zitadel/AuthServiceClientPb';
|
||||
import { ManagementServiceClient } from '../proto/generated/zitadel/ManagementServiceClientPb';
|
||||
import { fallbackLanguage, supportedLanguagesRegexp } from '../utils/language';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { EnvironmentService } from './environment.service';
|
||||
import { ExhaustedService } from './exhausted.service';
|
||||
@@ -40,8 +41,11 @@ export class GrpcService {
|
||||
public loadAppEnvironment(): Promise<any> {
|
||||
this.themeService.applyLabelPolicy();
|
||||
// We use the browser language until we can make API requests to get the users configured language.
|
||||
|
||||
const browserLanguage = this.translate.getBrowserLang();
|
||||
const language = browserLanguage?.match(supportedLanguagesRegexp) ? browserLanguage : fallbackLanguage;
|
||||
return this.translate
|
||||
.use(this.translate.getBrowserLang() || this.translate.defaultLang)
|
||||
.use(language || this.translate.defaultLang)
|
||||
.pipe(
|
||||
switchMap(() => this.envService.env),
|
||||
tap((env) => {
|
||||
|
||||
Reference in New Issue
Block a user