From 061c3ae6adac8d27c927156e9616ac86bd84beb8 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 16 Oct 2023 09:50:07 +0200 Subject: [PATCH] Added docs and translations. --- .../clarin-all-licenses-page.component.html | 9 +++++---- src/app/shared/html-content.service.ts | 7 +++++++ .../static-page/static-page-routing-paths.ts | 3 +++ .../static-page/static-page.component.scss | 3 +++ src/app/static-page/static-page.component.ts | 13 ++++++++++++ src/assets/i18n/cs.json5 | 20 ++++++++++++++++++- src/assets/i18n/en.json5 | 16 ++++++++++++++- 7 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html b/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html index 275c1a8f741..2d9c6d26ca4 100644 --- a/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html +++ b/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html @@ -6,11 +6,11 @@
{{ 'clarin.license.all-page.title' | translate }}
{{ clarinLicense.name }}
-
Source:
+
{{'clarin.license.all-page.source' | translate}}
{{ clarinLicense.definition }}
-
Labels:
+
{{'clarin.license.all-page.labels' | translate}}
{{clarinLicense.clarinLicenseLabel.title}} @@ -20,8 +20,9 @@
NONE +
{{'clarin.license.all-page.extra-information' | translate}}
+ {{'clarin.license.all-page.extra-information.default' | translate}} + {{requiredInformation?.value}} diff --git a/src/app/shared/html-content.service.ts b/src/app/shared/html-content.service.ts index cdf1efc4336..0120c591ac2 100644 --- a/src/app/shared/html-content.service.ts +++ b/src/app/shared/html-content.service.ts @@ -3,10 +3,17 @@ import { HttpClient } from '@angular/common/http'; import { catchError } from 'rxjs/operators'; import { of as observableOf } from 'rxjs'; +/** + * Service for loading static `.html` files stored in the `/static-files` folder. + */ @Injectable() export class HtmlContentService { constructor(private http: HttpClient) {} + /** + * Load `.html` file content or return empty string if an error. + * @param url file location + */ fetchHtmlContent(url: string) { // catchError -> return empty value. return this.http.get(url, { responseType: 'text' }).pipe( diff --git a/src/app/static-page/static-page-routing-paths.ts b/src/app/static-page/static-page-routing-paths.ts index 94bfa2daa71..8df2e5bcd36 100644 --- a/src/app/static-page/static-page-routing-paths.ts +++ b/src/app/static-page/static-page-routing-paths.ts @@ -1,3 +1,6 @@ +/** + * Constants for `/static` route. + */ export const STATIC_PAGE_PATH = 'static'; export const STATIC_FILES_PROJECT_PATH = 'static-files'; export const STATIC_FILES_DEFAULT_ERROR_PAGE_PATH = STATIC_FILES_PROJECT_PATH + '/' + 'error.html'; diff --git a/src/app/static-page/static-page.component.scss b/src/app/static-page/static-page.component.scss index e69de29bb2d..fe7baec6e4c 100644 --- a/src/app/static-page/static-page.component.scss +++ b/src/app/static-page/static-page.component.scss @@ -0,0 +1,3 @@ +/** +File for styling the `static-page` component. + */ diff --git a/src/app/static-page/static-page.component.ts b/src/app/static-page/static-page.component.ts index e607b6fe0fe..bd06f96f103 100644 --- a/src/app/static-page/static-page.component.ts +++ b/src/app/static-page/static-page.component.ts @@ -6,6 +6,10 @@ import { isEmpty, isNotEmpty } from '../shared/empty.util'; import { LocaleService } from '../core/locale/locale.service'; import { STATIC_FILES_DEFAULT_ERROR_PAGE_PATH, STATIC_FILES_PROJECT_PATH } from './static-page-routing-paths'; +/** + * Component which load and show static files from the `static-files` folder. + * E.g., `/static/test_file.html will load the file content from the `static-files/test_file.html`/ + */ @Component({ selector: 'ds-static-page', templateUrl: './static-page.component.html', @@ -50,6 +54,10 @@ export class StaticPageComponent implements OnInit { await this.loadErrorPage(); } + /** + * Load file name from the URL - `static/FILE_NAME.html` + * @private + */ private getHtmlFileName() { let urlInList = this.router.url?.split('/'); // Filter empty elements @@ -60,9 +68,14 @@ export class StaticPageComponent implements OnInit { return null; } + // If the url is too long take just the first string after `/static` prefix. return urlInList[1]; } + /** + * Load `static-files/error.html` + * @private + */ private async loadErrorPage() { let errorPage = await firstValueFrom(this.htmlContentService.fetchHtmlContent(STATIC_FILES_DEFAULT_ERROR_PAGE_PATH)); if (isEmpty(errorPage)) { diff --git a/src/assets/i18n/cs.json5 b/src/assets/i18n/cs.json5 index 049b7911501..6c0a0cef7cf 100644 --- a/src/assets/i18n/cs.json5 +++ b/src/assets/i18n/cs.json5 @@ -2604,6 +2604,21 @@ // "clarin.license.agreement.notification.cannot.send.email" : "Error: cannot send the email." "clarin.license.agreement.notification.cannot.send.email" : "Error: Nelze odeslat email.", +// "clarin.license.all-page.title": "Available Licenses", + "clarin.license.all-page.title": "Dostupné licence", + +// "clarin.license.all-page.source": "Source:", + "clarin.license.all-page.source": "Zdroj:", + +// "clarin.license.all-page.labels": "Labels:", + "clarin.license.all-page.labels": "Štítky:", + +// "clarin.license.all-page.extra-information": "Extra information required:", + "clarin.license.all-page.extra-information": "Vyžadovány dodatečné informace:", + +// "clarin.license.all-page.extra-information.default": "NONE", + "clarin.license.all-page.extra-information.default": "Žádné", + // "bitstream.edit.authorizations.link" : "Edit bitstream's Policies" "bitstream.edit.authorizations.link" : "Upravit zásady bitstreamu", @@ -4228,7 +4243,10 @@ "handle-table.change-handle-prefix.notify.error.empty-table" : "Chyba serveru - Nelze změnit globální předponu, protože neexistuje žádný Handle.", // "licenses.breadcrumbs" : "License administration" - "licenses.breadcrumbs" : "Správa licencí", + "licenses.breadcrumbs" : "License", + + // "licenses.breadcrumbs" : "License administration" + "licenses.manage-table.breadcrumbs" : "Správa licencí", // "info.end-user-agreement.accept" : "I have read and I agree to the End User Agreement" "info.end-user-agreement.accept" : "Přečetl/a jsem si smlouvu s koncovým uživatelem a souhlasím s ní.", diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 02cda93eeab..da91954ef28 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -704,8 +704,22 @@ "clarin.license.all-page.title": "Available Licenses", + "clarin.license.all-page.source": "Source:", - "bitstream.edit.authorizations.link": "Edit bitstream's Policies", + "clarin.license.all-page.labels": "Labels:", + + "clarin.license.all-page.extra-information": "Extra information required:", + + "clarin.license.all-page.extra-information.default": "NONE", + + + + + + + + + "bitstream.edit.authorizations.link",: "Edit bitstream's Policies", "bitstream.edit.authorizations.title": "Edit bitstream's Policies",