From b5ca5546b3f2fede822aacb4d4f973f916ba6775 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 26 Nov 2020 16:38:06 +0100 Subject: [PATCH] Extracted ui languages. --- frontend/app/shared/internal.ts | 3 ++- frontend/app/shared/state/ui-languages.ts | 21 +++++++++++++++++++ .../internal/profile-menu.component.html | 5 +++-- .../pages/internal/profile-menu.component.ts | 15 ++----------- 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 frontend/app/shared/state/ui-languages.ts diff --git a/frontend/app/shared/internal.ts b/frontend/app/shared/internal.ts index 54d68e61c..5a6c02a8f 100644 --- a/frontend/app/shared/internal.ts +++ b/frontend/app/shared/internal.ts @@ -47,9 +47,9 @@ export * from './state/clients.forms'; export * from './state/clients.state'; export * from './state/comments.form'; export * from './state/comments.state'; -export * from './state/contents.forms'; export * from './state/contents.forms-helpers'; export * from './state/contents.forms.visitors'; +export * from './state/contents.forms'; export * from './state/contents.state'; export * from './state/contributors.forms'; export * from './state/contributors.state'; @@ -69,6 +69,7 @@ export * from './state/schemas.forms'; export * from './state/schemas.state'; export * from './state/settings'; export * from './state/table-fields'; +export * from './state/ui-languages'; export * from './state/ui.state'; export * from './state/workflows.forms'; export * from './state/workflows.state'; diff --git a/frontend/app/shared/state/ui-languages.ts b/frontend/app/shared/state/ui-languages.ts new file mode 100644 index 000000000..97f1d5159 --- /dev/null +++ b/frontend/app/shared/state/ui-languages.ts @@ -0,0 +1,21 @@ +/* + * Squidex Headless CMS + * + * @license + * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. + */ + +type UILanguage = { iso2Code: string, localName: string }; + +export module UILanguages { + export const ALL: ReadonlyArray = [{ + iso2Code: 'en', + localName: 'English' + }, { + iso2Code: 'nl', + localName: 'Nederlands' + }, { + iso2Code: 'it', + localName: 'Italiano' + }]; +} \ No newline at end of file diff --git a/frontend/app/shell/pages/internal/profile-menu.component.html b/frontend/app/shell/pages/internal/profile-menu.component.html index 6c58a9fb8..00f338513 100644 --- a/frontend/app/shell/pages/internal/profile-menu.component.html +++ b/frontend/app/shell/pages/internal/profile-menu.component.html @@ -37,8 +37,9 @@ diff --git a/frontend/app/shell/pages/internal/profile-menu.component.ts b/frontend/app/shell/pages/internal/profile-menu.component.ts index ad392c401..1f170401c 100644 --- a/frontend/app/shell/pages/internal/profile-menu.component.ts +++ b/frontend/app/shell/pages/internal/profile-menu.component.ts @@ -6,7 +6,7 @@ */ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; -import { ApiUrlConfig, AuthService, fadeAnimation, ModalModel, StatefulComponent, UIOptions, UIState } from '@app/shared'; +import { ApiUrlConfig, AuthService, fadeAnimation, ModalModel, StatefulComponent, UILanguages, UIOptions, UIState } from '@app/shared'; interface State { // The display name of the user. @@ -22,17 +22,6 @@ interface State { profileUrl: string; } -const ALL_LANGUAGES: ReadonlyArray<{ code: string, name: string }> = [{ - code: 'en', - name: 'English' -}, { - code: 'nl', - name: 'Nederlands' -}, { - code: 'it', - name: 'Italiano' -}]; - @Component({ selector: 'sqx-profile-menu', styleUrls: ['./profile-menu.component.scss'], @@ -48,7 +37,7 @@ export class ProfileMenuComponent extends StatefulComponent implements On public showSubmenu = false; public language = this.uiOptions.get('more.culture'); - public languages = ALL_LANGUAGES; + public languages = UILanguages.ALL; constructor(changeDetector: ChangeDetectorRef, apiUrl: ApiUrlConfig, public readonly uiState: UIState,