diff --git a/src/components/dbp-cabinet-facets.js b/src/components/dbp-cabinet-facets.js index 372c61d..07c5b23 100644 --- a/src/components/dbp-cabinet-facets.js +++ b/src/components/dbp-cabinet-facets.js @@ -3,11 +3,52 @@ import {ScopedElementsMixin} from '@dbp-toolkit/common'; import {css, html, render, unsafeCSS} from 'lit'; import * as commonStyles from '@dbp-toolkit/common/styles'; +import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element'; import DBPCabinetLitElement from '../dbp-cabinet-lit-element.js'; import {panel, refinementList } from 'instantsearch.js/es/widgets/index.js'; import {connectCurrentRefinements, connectClearRefinements} from 'instantsearch.js/es/connectors'; import {createDateRefinement} from './dbp-cabinet-date-facet.js'; import {getIconSVGURL} from '../utils.js'; +import {createInstance} from '../i18n.js'; + +class FacetLabel extends DBPLitElement { + constructor() { + super(); + this._i18n = createInstance(); + this.lang = this._i18n.language; + this.namespace = ""; + this.value = ""; + } + + static get properties() { + return { + ...super.properties, + lang: {type: String}, + namespace: {type: String}, + value: {type: String}, + }; + } + + render() { + let text = this._i18n.t(`typesense-schema.${this.namespace}.${this.value}`, this.value); + return html`${text}`; + } + + update(changedProperties) { + changedProperties.forEach((oldValue, propName) => { + switch (propName) { + case 'lang': + this._i18n.changeLanguage(this.lang); + break; + } + }); + + super.update(changedProperties); + } +} + +// FIXME: don't register globally +customElements.define('dbp-cabinet-facet-label', FacetLabel); export class CabinetFacets extends ScopedElementsMixin(DBPCabinetLitElement) { constructor() { @@ -355,9 +396,7 @@ export class CabinetFacets extends ScopedElementsMixin(DBPCabinetLitElement) { value="${item.value}" checked=${item.isRefined} /> - - ${item.label} - + (${item.count}) diff --git a/src/i18n/de/translation.json b/src/i18n/de/translation.json index a8a0751..c8e221d 100644 --- a/src/i18n/de/translation.json +++ b/src/i18n/de/translation.json @@ -1,4 +1,118 @@ { + "typesense-schema": { + "@type": { + "Person": "Person", + "DocumentFile": "Dokument" + }, + "file.base.fileSource": { + "cabinet-bucket": "Manuell hochgeladen" + }, + "file.base.isPartOf": { + "CostReimbursement": "Kostenerstattung" + }, + "file.file-cabinet-admissionNotice.decision": { + "rejected": "Abgelehnt", + "refused": "Verweigert", + "granted": "Bewilligt" + }, + "file.base.mimeType": { + "application/pdf": "PDF (.pdf)" + }, + "file.file-cabinet-citizenshipCertificate.nationality": { + "ALB": "Albanien", + "AND": "Andorra", + "AUT": "Österreich", + "BLR": "Belarus", + "BEL": "Belgien", + "BIH": "Bosnien und Herzegowina", + "BGR": "Bulgarien", + "HRV": "Kroatien", + "CYP": "Zypern", + "CZE": "Tschechische Republik", + "DNK": "Dänemark", + "EST": "Estland", + "FIN": "Finnland", + "FRA": "Frankreich", + "DEU": "Deutschland", + "GRC": "Griechenland", + "HUN": "Ungarn", + "ISL": "Island", + "IRL": "Irland", + "ITA": "Italien", + "LVA": "Lettland", + "LIE": "Liechtenstein", + "LTU": "Litauen", + "LUX": "Luxemburg", + "MLT": "Malta", + "MDA": "Moldawien", + "MCO": "Monaco", + "MNE": "Montenegro", + "NLD": "Niederlande", + "MKD": "Nordmazedonien", + "NOR": "Norwegen", + "POL": "Polen", + "PRT": "Portugal", + "ROU": "Rumänien", + "RUS": "Russland", + "SMR": "San Marino", + "SRB": "Serbien", + "SVK": "Slowakei", + "SVN": "Slowenien", + "ESP": "Spanien", + "SWE": "Schweden", + "CHE": "Schweiz", + "UKR": "Ukraine", + "GBR": "Vereinigtes Königreich", + "VAT": "Vatikanstadt" + }, + "file.file-cabinet-identityDocument.nationality": { + "ALB": "Albanien", + "AND": "Andorra", + "AUT": "Österreich", + "BLR": "Belarus", + "BEL": "Belgien", + "BIH": "Bosnien und Herzegowina", + "BGR": "Bulgarien", + "HRV": "Kroatien", + "CYP": "Zypern", + "CZE": "Tschechische Republik", + "DNK": "Dänemark", + "EST": "Estland", + "FIN": "Finnland", + "FRA": "Frankreich", + "DEU": "Deutschland", + "GRC": "Griechenland", + "HUN": "Ungarn", + "ISL": "Island", + "IRL": "Irland", + "ITA": "Italien", + "LVA": "Lettland", + "LIE": "Liechtenstein", + "LTU": "Litauen", + "LUX": "Luxemburg", + "MLT": "Malta", + "MDA": "Moldawien", + "MCO": "Monaco", + "MNE": "Montenegro", + "NLD": "Niederlande", + "MKD": "Nordmazedonien", + "NOR": "Norwegen", + "POL": "Polen", + "PRT": "Portugal", + "ROU": "Rumänien", + "RUS": "Russland", + "SMR": "San Marino", + "SRB": "Serbien", + "SVK": "Slowakei", + "SVN": "Slowenien", + "ESP": "Spanien", + "SWE": "Schweden", + "CHE": "Schweiz", + "UKR": "Ukraine", + "GBR": "Vereinigtes Königreich", + "VAT": "Vatikanstadt" + } + }, "cabinet-search": { "filters": "Filter", "type-filter-group-title": "Kategorie", @@ -26,8 +140,8 @@ "filter-study-type-title": "Abschlussziel", "filter-study-status-text-title": "Studienstatus", "filter-file-base-additional-type-text-title": "Dokumenttyp", - "filter-file-base-mime-type-title": "MIME typ", - "filter-file-base-file-source-title": "Digitalisatsquelle", + "filter-file-base-mime-type-title": "Dateiformat", + "filter-file-base-file-source-title": "Dateiquelle", "filter-file-base-semester-title": "Semester", "filter-file-base-study-field-name-title": "Studium", "filter-file-base-is-part-of-title": "Zugeordneter Vorgang", diff --git a/src/i18n/en/translation.json b/src/i18n/en/translation.json index e14a9b2..d3d760a 100644 --- a/src/i18n/en/translation.json +++ b/src/i18n/en/translation.json @@ -1,4 +1,118 @@ { + "typesense-schema": { + "@type": { + "Person": "Person", + "DocumentFile": "Document" + }, + "file.base.fileSource": { + "cabinet-bucket": "Manually uploaded" + }, + "file.base.isPartOf": { + "CostReimbursement": "Cost Reimbursement" + }, + "file.file-cabinet-admissionNotice.decision": { + "rejected": "Rejected", + "refused": "Refused", + "granted": "Granted" + }, + "file.base.mimeType": { + "application/pdf": "PDF (.pdf)" + }, + "file.file-cabinet-citizenshipCertificate.nationality": { + "ALB": "Albania", + "AND": "Andorra", + "AUT": "Austria", + "BLR": "Belarus", + "BEL": "Belgium", + "BIH": "Bosnia and Herzegovina", + "BGR": "Bulgaria", + "HRV": "Croatia", + "CYP": "Cyprus", + "CZE": "Czech Republic", + "DNK": "Denmark", + "EST": "Estonia", + "FIN": "Finland", + "FRA": "France", + "DEU": "Germany", + "GRC": "Greece", + "HUN": "Hungary", + "ISL": "Iceland", + "IRL": "Ireland", + "ITA": "Italy", + "LVA": "Latvia", + "LIE": "Liechtenstein", + "LTU": "Lithuania", + "LUX": "Luxembourg", + "MLT": "Malta", + "MDA": "Moldova", + "MCO": "Monaco", + "MNE": "Montenegro", + "NLD": "Netherlands", + "MKD": "North Macedonia", + "NOR": "Norway", + "POL": "Poland", + "PRT": "Portugal", + "ROU": "Romania", + "RUS": "Russia", + "SMR": "San Marino", + "SRB": "Serbia", + "SVK": "Slovakia", + "SVN": "Slovenia", + "ESP": "Spain", + "SWE": "Sweden", + "CHE": "Switzerland", + "UKR": "Ukraine", + "GBR": "United Kingdom", + "VAT": "Vatican City" + }, + "file.file-cabinet-identityDocument.nationality": { + "ALB": "Albania", + "AND": "Andorra", + "AUT": "Austria", + "BLR": "Belarus", + "BEL": "Belgium", + "BIH": "Bosnia and Herzegovina", + "BGR": "Bulgaria", + "HRV": "Croatia", + "CYP": "Cyprus", + "CZE": "Czech Republic", + "DNK": "Denmark", + "EST": "Estonia", + "FIN": "Finland", + "FRA": "France", + "DEU": "Germany", + "GRC": "Greece", + "HUN": "Hungary", + "ISL": "Iceland", + "IRL": "Ireland", + "ITA": "Italy", + "LVA": "Latvia", + "LIE": "Liechtenstein", + "LTU": "Lithuania", + "LUX": "Luxembourg", + "MLT": "Malta", + "MDA": "Moldova", + "MCO": "Monaco", + "MNE": "Montenegro", + "NLD": "Netherlands", + "MKD": "North Macedonia", + "NOR": "Norway", + "POL": "Poland", + "PRT": "Portugal", + "ROU": "Romania", + "RUS": "Russia", + "SMR": "San Marino", + "SRB": "Serbia", + "SVK": "Slovakia", + "SVN": "Slovenia", + "ESP": "Spain", + "SWE": "Sweden", + "CHE": "Switzerland", + "UKR": "Ukraine", + "GBR": "United Kingdom", + "VAT": "Vatican City" + } + }, "cabinet-search": { "filters": "Filters", "type-filter-group-title": "Category", @@ -26,8 +140,8 @@ "filter-study-type-title": "Degree", "filter-study-status-text-title": "Study status", "filter-file-base-additional-type-text-title": "Document type", - "filter-file-base-mime-type-title": "MIME type", - "filter-file-base-file-source-title": "Digital document source", + "filter-file-base-mime-type-title": "File format", + "filter-file-base-file-source-title": "File source", "filter-file-base-semester-title": "Semester", "filter-file-base-study-field-name-title": "Study field", "filter-file-base-is-part-of-title": "Assigned process",