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 11, 2024
1 parent 06f3b63 commit 02dacab
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
import { getOptionalSearchConfig } from 'geonetwork-ui'

marker('mel.datahub.search.filters.categoryKeyword')
marker('mel.datahub.search.filters.publisher')
marker('mel.datahub.search.filters.revisionYear')
marker('mel.datahub.search.filters.license')
marker('mel.datahub.search.filters.format')
marker('mel.datahub.search.filters.publicationYear')
marker('mel.datahub.search.filters.inspireKeyword')
marker('mel.datahub.search.filters.keyword')
marker('mel.datahub.search.filters.topic')
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 @@ -13,12 +22,14 @@ marker('mel.datahub.search.filters.license')
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SearchFiltersComponent {
searchConfig = [
'categoryKeyword',
'publisher',
'revisionYear',
'license',
].map((filter) => ({
searchConfig = (
getOptionalSearchConfig().ADVANCED_FILTERS || [
'categoryKeyword',
'publisher',
'revisionYear',
'license',
]
).map((filter) => ({
fieldName: filter,
title: `mel.datahub.search.filters.${filter}`,
}))
Expand Down
8 changes: 8 additions & 0 deletions resources/translations/en_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@
"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.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
8 changes: 8 additions & 0 deletions resources/translations/fr_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@
"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.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.filters.topic": "Thème",
"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 02dacab

Please sign in to comment.