Skip to content

Commit

Permalink
refactor(fields): handle filter field title i18n
Browse files Browse the repository at this point in the history
the code expect the translation to be search.filters.{fieldName}
  • Loading branch information
fgravin committed Sep 18, 2023
1 parent d791af9 commit 65b2f43
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ import {
} from '@geonetwork-ui/feature/search'
import { getOptionalSearchConfig } from '@geonetwork-ui/util/app-config'

marker('search.filters.format')
marker('search.filters.inspireKeyword')
marker('search.filters.isSpatial')
marker('search.filters.license')
marker('search.filters.publisher')
marker('search.filters.representationType')
marker('search.filters.resourceType')
marker('search.filters.standard')
marker('search.filters.topic')

@Component({
selector: 'datahub-search-filters',
templateUrl: './search-filters.component.html',
Expand Down Expand Up @@ -53,52 +63,10 @@ export class SearchFiltersComponent implements OnInit {
return false
}
})
.map((filter) => {
switch (filter) {
case 'publisher':
return {
fieldName: filter,
title: marker('search.filters.byOrganisation'),
}
case 'format':
return {
fieldName: filter,
title: marker('search.filters.byFormat'),
}
case 'standard':
return {
fieldName: filter,
title: marker('search.filters.byStandard'),
}
case 'inspireKeyword':
return {
fieldName: filter,
title: marker('search.filters.byInspireKeyword'),
}
case 'topic':
return {
fieldName: filter,
title: marker('search.filters.byTopic'),
}
case 'publicationYear':
return {
fieldName: filter,
title: marker('search.filters.byPublicationYear'),
}
case 'isSpatial':
return {
fieldName: filter,
title: marker('search.filters.isSpatial'),
}
case 'license':
return {
fieldName: filter,
title: marker('search.filters.byLicense'),
}
default:
return { fieldName: filter, title: filter }
}
})
.map((filter) => ({
fieldName: filter,
title: `search.filters.${filter}`,
}))
}

open() {
Expand Down
16 changes: 9 additions & 7 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@
"search.error.receivedError": "Ein Fehler wurde empfangen",
"search.error.recordNotFound": "Der Datensatz mit der Kennung \"{ id }\" konnte nicht gefunden werden.",
"search.field.any.placeholder": "Suche nach Datensätzen, Diensten und Karten ...",
"search.field.location.placeholder": "",
"search.field.sortBy": "Sortieren nach:",
"search.filters.byFormat": "Formate",
"search.filters.byInspireKeyword": "INSPIRE-Schlüsselwort",
"search.filters.byLicense": "Lizenz",
"search.filters.byOrganisation": "Organisationen",
"search.filters.byPublicationYear": "Veröffentlichungsjahr",
"search.filters.byStandard": "Standard",
"search.filters.byTopic": "Thema",
"search.filters.clear": "Zurücksetzen",
"search.filters.format": "Formate",
"search.filters.inspireKeyword": "INSPIRE-Schlüsselwort",
"search.filters.isSpatial": "Ist räumliche Daten",
"search.filters.isSpatial.no": "nicht räumlich",
"search.filters.isSpatial.yes": "räumlich",
"search.filters.license": "Lizenz",
"search.filters.license.cc-by": "Creative Commons CC-BY",
"search.filters.license.cc-by-sa": "Creative Commons CC-BY-SA",
"search.filters.license.cc-zero": "Creative Commons CC-0",
Expand All @@ -234,7 +231,12 @@
"search.filters.license.unknown": "Unbekannt oder nicht vorhanden",
"search.filters.maximize": "Erweitern",
"search.filters.minimize": "Minimieren",
"search.filters.publisher": "Organisationen",
"search.filters.representationType": "",
"search.filters.resourceType": "",
"search.filters.standard": "Standard",
"search.filters.title": "Ergebnisse filtern",
"search.filters.topic": "Thema",
"search.filters.useSpatialFilter": "Zuerst Datensätze im Interessenbereich anzeigen",
"search.filters.useSpatialFilterHelp": "Wenn diese Option aktiviert ist, werden Datensätze im Bereich des Katalogs zuerst angezeigt. Datensätze außerhalb dieses Bereichs werden nicht angezeigt.",
"share.tab.permalink": "Teilen",
Expand Down
16 changes: 9 additions & 7 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@
"search.error.receivedError": "An error was received",
"search.error.recordNotFound": "The record with identifier \"{ id }\" could not be found.",
"search.field.any.placeholder": "Search datasets, services and maps ...",
"search.field.location.placeholder": "",
"search.field.sortBy": "Sort by:",
"search.filters.byFormat": "Formats",
"search.filters.byInspireKeyword": "INSPIRE keyword",
"search.filters.byLicense": "License",
"search.filters.byOrganisation": "Organisations",
"search.filters.byPublicationYear": "Publication year",
"search.filters.byStandard": "Standard",
"search.filters.byTopic": "Topic",
"search.filters.clear": "Reset",
"search.filters.format": "Formats",
"search.filters.inspireKeyword": "INSPIRE keyword",
"search.filters.isSpatial": "Is spatial data",
"search.filters.isSpatial.no": "non spatial",
"search.filters.isSpatial.yes": "spatial",
"search.filters.license": "",
"search.filters.license.cc-by": "Creative Commons CC-BY",
"search.filters.license.cc-by-sa": "Creative Commons CC-BY-SA",
"search.filters.license.cc-zero": "Creative Commons CC-0",
Expand All @@ -234,7 +231,12 @@
"search.filters.license.unknown": "Unknown or absent",
"search.filters.maximize": "Expand",
"search.filters.minimize": "Minimize",
"search.filters.publisher": "Organizations",
"search.filters.representationType": "Representation type",
"search.filters.resourceType": "Resource type",
"search.filters.standard": "Standard",
"search.filters.title": "Filter your results",
"search.filters.topic": "Topic",
"search.filters.useSpatialFilter": "Show records in the area of interest first",
"search.filters.useSpatialFilterHelp": "When this is enabled, records situated in the catalog's area of interest are shown first; records outside of this area will not show up.",
"share.tab.permalink": "Share",
Expand Down
16 changes: 9 additions & 7 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@
"search.error.receivedError": "",
"search.error.recordNotFound": "",
"search.field.any.placeholder": "",
"search.field.location.placeholder": "",
"search.field.sortBy": "",
"search.filters.byFormat": "",
"search.filters.byInspireKeyword": "",
"search.filters.byLicense": "",
"search.filters.byOrganisation": "",
"search.filters.byPublicationYear": "",
"search.filters.byStandard": "",
"search.filters.byTopic": "",
"search.filters.clear": "",
"search.filters.format": "",
"search.filters.inspireKeyword": "",
"search.filters.isSpatial": "",
"search.filters.isSpatial.no": "",
"search.filters.isSpatial.yes": "",
"search.filters.license": "",
"search.filters.license.cc-by": "",
"search.filters.license.cc-by-sa": "",
"search.filters.license.cc-zero": "",
Expand All @@ -234,7 +231,12 @@
"search.filters.license.unknown": "",
"search.filters.maximize": "",
"search.filters.minimize": "",
"search.filters.publisher": "",
"search.filters.representationType": "",
"search.filters.resourceType": "",
"search.filters.standard": "",
"search.filters.title": "",
"search.filters.topic": "",
"search.filters.useSpatialFilter": "",
"search.filters.useSpatialFilterHelp": "",
"share.tab.permalink": "",
Expand Down
28 changes: 15 additions & 13 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,30 +211,32 @@
"search.error.receivedError": "Erreur retournée",
"search.error.recordNotFound": "Cette donnée n'a pu être trouvée.",
"search.field.any.placeholder": "Rechercher une fiche de métadonnée...",
"search.field.location.placeholder": "",
"search.field.sortBy": "Trier par :",
"search.filters.byFormat": "Formats",
"search.filters.byInspireKeyword": "Mot-clé INSPIRE",
"search.filters.byLicense": "Licence",
"search.filters.byOrganisation": "Organisations",
"search.filters.byPublicationYear": "Année de publication",
"search.filters.byStandard": "",
"search.filters.byTopic": "Thème",
"search.filters.clear": "Réinitialiser",
"search.filters.format": "Formats",
"search.filters.inspireKeyword": "Mot-clé INSPIRE",
"search.filters.isSpatial": "Données spatiales",
"search.filters.isSpatial.no": "non-géolocalisées",
"search.filters.isSpatial.yes": "géolocalisées",
"search.filters.license.cc-by": "",
"search.filters.license.cc-by-sa": "",
"search.filters.license.cc-zero": "",
"search.filters.license": "Licence",
"search.filters.license.cc-by": "cc-by",
"search.filters.license.cc-by-sa": "cc-by-sa",
"search.filters.license.cc-zero": "cc-zero",
"search.filters.license.etalab": "Licence Ouverte (Etalab)",
"search.filters.license.etalab-v2": "Licence Ouverte v2.0 (Etalab)",
"search.filters.license.odbl": "",
"search.filters.license.odc-by": "",
"search.filters.license.pddl": "",
"search.filters.license.odbl": "odbl",
"search.filters.license.odc-by": "odc-by",
"search.filters.license.pddl": "pddl",
"search.filters.license.unknown": "Non-reconnue ou absente",
"search.filters.maximize": "Agrandir",
"search.filters.minimize": "Réduire",
"search.filters.publisher": "Organisations",
"search.filters.representationType": "Type de représentation",
"search.filters.resourceType": "Type de ressource",
"search.filters.standard": "Standard",
"search.filters.title": "Affiner votre recherche",
"search.filters.topic": "Thème",
"search.filters.useSpatialFilter": "Mettre en avant les résultats sur la zone d'intérêt",
"search.filters.useSpatialFilterHelp": "Si cette option est activée, les fiches portant sur la zone d'intérêt du catalogue seront montrées en premier; les fiches en dehors de cette zone n'apparaitront pas dans les résultats.",
"share.tab.permalink": "Partager",
Expand Down
16 changes: 9 additions & 7 deletions translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@
"search.error.receivedError": "",
"search.error.recordNotFound": "",
"search.field.any.placeholder": "",
"search.field.location.placeholder": "",
"search.field.sortBy": "",
"search.filters.byFormat": "",
"search.filters.byInspireKeyword": "",
"search.filters.byLicense": "",
"search.filters.byOrganisation": "",
"search.filters.byPublicationYear": "",
"search.filters.byStandard": "",
"search.filters.byTopic": "",
"search.filters.clear": "",
"search.filters.format": "",
"search.filters.inspireKeyword": "",
"search.filters.isSpatial": "",
"search.filters.isSpatial.no": "",
"search.filters.isSpatial.yes": "",
"search.filters.license": "",
"search.filters.license.cc-by": "",
"search.filters.license.cc-by-sa": "",
"search.filters.license.cc-zero": "",
Expand All @@ -234,7 +231,12 @@
"search.filters.license.unknown": "",
"search.filters.maximize": "",
"search.filters.minimize": "",
"search.filters.publisher": "",
"search.filters.representationType": "",
"search.filters.resourceType": "",
"search.filters.standard": "",
"search.filters.title": "",
"search.filters.topic": "",
"search.filters.useSpatialFilter": "",
"search.filters.useSpatialFilterHelp": "",
"share.tab.permalink": "",
Expand Down
16 changes: 9 additions & 7 deletions translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@
"search.error.receivedError": "",
"search.error.recordNotFound": "",
"search.field.any.placeholder": "",
"search.field.location.placeholder": "",
"search.field.sortBy": "",
"search.filters.byFormat": "",
"search.filters.byInspireKeyword": "",
"search.filters.byLicense": "",
"search.filters.byOrganisation": "",
"search.filters.byPublicationYear": "",
"search.filters.byStandard": "",
"search.filters.byTopic": "",
"search.filters.clear": "",
"search.filters.format": "",
"search.filters.inspireKeyword": "",
"search.filters.isSpatial": "",
"search.filters.isSpatial.no": "",
"search.filters.isSpatial.yes": "",
"search.filters.license": "",
"search.filters.license.cc-by": "",
"search.filters.license.cc-by-sa": "",
"search.filters.license.cc-zero": "",
Expand All @@ -234,7 +231,12 @@
"search.filters.license.unknown": "",
"search.filters.maximize": "",
"search.filters.minimize": "",
"search.filters.publisher": "",
"search.filters.representationType": "",
"search.filters.resourceType": "",
"search.filters.standard": "",
"search.filters.title": "",
"search.filters.topic": "",
"search.filters.useSpatialFilter": "",
"search.filters.useSpatialFilterHelp": "",
"share.tab.permalink": "",
Expand Down
16 changes: 9 additions & 7 deletions translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@
"search.error.receivedError": "",
"search.error.recordNotFound": "",
"search.field.any.placeholder": "",
"search.field.location.placeholder": "",
"search.field.sortBy": "",
"search.filters.byFormat": "",
"search.filters.byInspireKeyword": "",
"search.filters.byLicense": "",
"search.filters.byOrganisation": "",
"search.filters.byPublicationYear": "",
"search.filters.byStandard": "",
"search.filters.byTopic": "",
"search.filters.clear": "",
"search.filters.format": "",
"search.filters.inspireKeyword": "",
"search.filters.isSpatial": "",
"search.filters.isSpatial.no": "",
"search.filters.isSpatial.yes": "",
"search.filters.license": "",
"search.filters.license.cc-by": "",
"search.filters.license.cc-by-sa": "",
"search.filters.license.cc-zero": "",
Expand All @@ -234,7 +231,12 @@
"search.filters.license.unknown": "",
"search.filters.maximize": "",
"search.filters.minimize": "",
"search.filters.publisher": "",
"search.filters.representationType": "",
"search.filters.resourceType": "",
"search.filters.standard": "",
"search.filters.title": "",
"search.filters.topic": "",
"search.filters.useSpatialFilter": "",
"search.filters.useSpatialFilterHelp": "",
"share.tab.permalink": "",
Expand Down

0 comments on commit 65b2f43

Please sign in to comment.