Skip to content

Commit

Permalink
feat: use config file for filters and add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jul 16, 2024
1 parent 833214f commit 49e2201
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
import { RouterFacade } from 'geonetwork-ui'
import { getOptionalSearchConfig } from 'geonetwork-ui'

marker('mel.datahub.search.filters.topic')
marker('mel.datahub.search.filters.categoryKeyword')
Expand All @@ -11,6 +12,12 @@ marker('mel.datahub.search.filters.qualityScore')
marker('mel.datahub.search.filters.territories')
marker('mel.datahub.search.filters.producerOrg')
marker('mel.datahub.search.filters.publisherOrg')
marker('mel.datahub.search.filters.format')
marker('mel.datahub.search.filters.inspireKeyword')
marker('mel.datahub.search.filters.keyword')
marker('mel.datahub.search.filters.isSpatial')
marker('mel.datahub.search.filters.resourceType')
marker('mel.datahub.search.filters.representationType')

@Component({
selector: 'mel-datahub-search-filters',
Expand All @@ -21,14 +28,16 @@ marker('mel.datahub.search.filters.publisherOrg')
export class SearchFiltersComponent {
constructor(private routerFacade: RouterFacade) {}
displayCount = 3
searchConfig = [
'categoryKeyword',
'organization',
'publicationYear',
'license',
'qualityScore',
'territories',
].map((filter) => ({
searchConfig = (
getOptionalSearchConfig().ADVANCED_FILTERS || [
'categoryKeyword',
'organization',
'publicationYear',
'license',
'qualityScore',
'territories',
]
).map((filter) => ({
fieldName: filter,
title: `mel.datahub.search.filters.${filter}`,
}))
Expand Down
12 changes: 10 additions & 2 deletions resources/translations/en_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,30 @@
"mel.datahub.multiselect.filter.placeholder": "",
"mel.datahub.search.clear": "",
"mel.datahub.search.filters.categoryKeyword": "",
"mel.datahub.search.filters.format": "",
"mel.datahub.search.filters.inspireKeyword": "",
"mel.datahub.search.filters.isSpatial": "",
"mel.datahub.search.filters.keyword": "",
"mel.datahub.search.filters.license": "",
"mel.datahub.search.filters.maxValue": "",
"mel.datahub.search.filters.minValue": "",
"mel.datahub.search.filters.more": "",
"mel.datahub.search.filters.organization": "",
"mel.datahub.search.filters.producerOrg": "",
"mel.datahub.search.filters.publicationYear": "",
"mel.datahub.search.filters.publisherOrg": "",
"mel.datahub.search.filters.qualityScore": "",
"mel.datahub.search.filters.range.from": "",
"mel.datahub.search.filters.range.to": "",
"mel.datahub.search.filters.reduce": "",
"mel.datahub.search.filters.reset": "",
"mel.datahub.search.filters.territories": "",
"mel.datahub.search.filters.topic": "",
"mel.datahub.search.filters.validate": "",
"mel.datahub.search.filters.publicationYear": "",
"mel.datahub.search.filters.publisher": "",
"mel.datahub.search.filters.representationType": "",
"mel.datahub.search.filters.resourceType": "",
"mel.datahub.search.filters.revisionYear": "",
"mel.datahub.search.filters.topic": "",
"mel.datahub.search.form.description": "",
"mel.datahub.search.form.title": "",
"mel.datahub.search.hits.found": "",
Expand Down
10 changes: 9 additions & 1 deletion resources/translations/fr_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
"mel.datahub.multiselect.filter.placeholder": "Rechercher",
"mel.datahub.search.clear": "Effacer",
"mel.datahub.search.filters.categoryKeyword": "Thématique",
"mel.datahub.search.filters.format": "Format",
"mel.datahub.search.filters.inspireKeyword": "Mot-clé INSPIRE",
"mel.datahub.search.filters.isSpatial": "Données spatiales",
"mel.datahub.search.filters.keyword": "Mot-clé",
"mel.datahub.search.filters.license": "Licence",
"mel.datahub.search.filters.maxValue": "Valeur maximale",
"mel.datahub.search.filters.minValue": "Valeur minimale",
"mel.datahub.search.filters.more": "Plus de filtres",
"mel.datahub.search.filters.organization": "Organisation",
"mel.datahub.search.filters.producerOrg": "Producteur",
"mel.datahub.search.filters.publicationYear": "Date",
"mel.datahub.search.filters.publisherOrg": "Distributeur",
"mel.datahub.search.filters.qualityScore": "Score de qualité",
"mel.datahub.search.filters.range.from": "De :",
Expand All @@ -27,6 +30,11 @@
"mel.datahub.search.filters.territories": "Territoires",
"mel.datahub.search.filters.topic": "Catégories",
"mel.datahub.search.filters.validate": "Valider",
"mel.datahub.search.filters.publicationYear": "Année de publication",
"mel.datahub.search.filters.publisher": "Producteur",
"mel.datahub.search.filters.representationType": "Type de représentation",
"mel.datahub.search.filters.resourceType": "Type de ressource",
"mel.datahub.search.filters.revisionYear": "Date",
"mel.datahub.search.form.description": "Vous pouvez utiliser la barre de recherche ou les différents filtres situés ci-dessous pour trouver un jeu de données plus rapidement.",
"mel.datahub.search.form.title": "Trouver un jeu de données",
"mel.datahub.search.hits.found": "{hits, plural, =0{Aucune correspondance.} one{1 enregistrement trouvé.} other{Ensemble des données: {hits}}}",
Expand Down

0 comments on commit 49e2201

Please sign in to comment.