From b16b74a28a5a9fb208914b2a5a17e2b2a8aad521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Hallundb=C3=A6k?= <72447095+tha-nordiq@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:07:20 +0200 Subject: [PATCH] Catalog editor i18n (#10571) --- .../__tests__/CatalogServiceEditor-test.jsx | 8 ------- .../components/catalog/editor/MainForm.jsx | 10 ++++----- .../catalog/editor/MainFormUtils.js | 21 ------------------- web/client/translations/data.da-DK.json | 12 +++++++++++ web/client/translations/data.de-DE.json | 12 +++++++++++ web/client/translations/data.en-US.json | 12 +++++++++++ web/client/translations/data.es-ES.json | 12 +++++++++++ web/client/translations/data.fi-FI.json | 12 +++++++++++ web/client/translations/data.fr-FR.json | 12 +++++++++++ web/client/translations/data.hr-HR.json | 12 +++++++++++ web/client/translations/data.is-IS.json | 12 +++++++++++ web/client/translations/data.it-IT.json | 12 +++++++++++ web/client/translations/data.nl-NL.json | 12 +++++++++++ web/client/translations/data.pt-PT.json | 11 ++++++++++ web/client/translations/data.sk-SK.json | 11 ++++++++++ web/client/translations/data.sv-SE.json | 11 ++++++++++ web/client/translations/data.vi-VN.json | 11 ++++++++++ web/client/translations/data.zh-ZH.json | 11 ++++++++++ 18 files changed, 180 insertions(+), 34 deletions(-) diff --git a/web/client/components/catalog/__tests__/CatalogServiceEditor-test.jsx b/web/client/components/catalog/__tests__/CatalogServiceEditor-test.jsx index afbe3859db..9639633fc2 100644 --- a/web/client/components/catalog/__tests__/CatalogServiceEditor-test.jsx +++ b/web/client/components/catalog/__tests__/CatalogServiceEditor-test.jsx @@ -10,7 +10,6 @@ import ReactDOM from 'react-dom'; import expect from 'expect'; import TestUtils from 'react-dom/test-utils'; import CatalogServiceEditor from '../CatalogServiceEditor'; -import {defaultPlaceholder} from "../editor/MainFormUtils"; const givenWmsService = { url: "url", @@ -140,13 +139,6 @@ describe('Test CatalogServiceEditor', () => { const isLocalizedLayerStylesOption = document.querySelector('[data-qa="service-lacalized-layer-styles-option"]'); expect(isLocalizedLayerStylesOption).toBeNull; }); - it('test defaultPlaceholder function for the main form placeholder urls', () => { - let service = { - type: "wms" - }; - let placeholder = defaultPlaceholder(service); - expect(placeholder).toBe("e.g. https://mydomain.com/geoserver/wms"); - }); it('test save and delete button when saving', () => { ReactDOM.render( { } }) => { style={{ textOverflow: "ellipsis" }} - placeholder={defaultPlaceholder(service)} + placeholder={'catalog.urlPlaceHolders.' + service.type} value={service && service.url} onChange={(e) => onChangeUrl(e.target.value)}/> @@ -89,7 +89,7 @@ const TmsURLEditor = ({ serviceTypes = [], onChangeServiceProperty, service = {} style={{ textOverflow: "ellipsis" }} - placeholder={"e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}"} + placeholder="catalog.urlPlaceHolders.custom" value={service && service.url} onChange={(e) => onChangeUrl(e.target.value)} /> @@ -101,7 +101,7 @@ const TmsURLEditor = ({ serviceTypes = [], onChangeServiceProperty, service = {} style={{ textOverflow: "ellipsis" }} - placeholder={defaultPlaceholder(service)} + placeholder="catalog.urlPlaceHolders.tms" value={service && service.url} onChange={(e) => onChangeUrl(e.target.value)} /> @@ -121,7 +121,7 @@ const COGEditor = ({ service = {}, onChangeServiceProperty = () => { } }) => { style={{ textOverflow: "ellipsis" }} - placeholder={defaultPlaceholder(service)} + placeholder="catalog.urlPlaceHolders.cog" value={service && service.records && service.records.map(record => record?.url)?.join(',')} onChange={(e) => { let urls = e.target.value || ""; diff --git a/web/client/components/catalog/editor/MainFormUtils.js b/web/client/components/catalog/editor/MainFormUtils.js index a2d16a13d5..6c46717433 100644 --- a/web/client/components/catalog/editor/MainFormUtils.js +++ b/web/client/components/catalog/editor/MainFormUtils.js @@ -1,25 +1,4 @@ import url from 'url'; - -export const defaultPlaceholder = (service) => { - let urlPlaceholder = { - "wfs": "e.g. https://mydomain.com/geoserver/wfs", - "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", - "wms": "e.g. https://mydomain.com/geoserver/wms", - "csw": "e.g. https://mydomain.com/geoserver/csw", - "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", - "3dtiles": "e.g. https://mydomain.com/tileset.json", - "cog": "e.g. https://mydomain.com/cog.tif", - "model": "e.g. https://mydomain.com/filename.ifc", - "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" - }; - for ( const [key, value] of Object.entries(urlPlaceholder)) { - if ( key === service.type) { - return value; - } - } - return true; -}; - /** * Check if the URL typed is valid or not * @param {string} catalogUrl The URL of the catalog diff --git a/web/client/translations/data.da-DK.json b/web/client/translations/data.da-DK.json index 264a792164..afb718229d 100644 --- a/web/client/translations/data.da-DK.json +++ b/web/client/translations/data.da-DK.json @@ -1477,6 +1477,18 @@ "servicePlaceholder": "type a service", "url": "URL", "urlPlaceholder": "type a URL", + "urlPlaceHolders": { + "wfs": "f.eks. https://mydomain.com/geoserver/wfs", + "wmts": "f.eks. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "f.eks. https://mydomain.com/geoserver/wms", + "csw": "f.eks. https://mydomain.com/geoserver/csw", + "tms": "f.eks. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "f.eks. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "f.eks. https://mydomain.com/tileset.json", + "cog": "f.eks. https://mydomain.com/cog.tif", + "model": "f.eks. https://mydomain.com/filename.ifc", + "arcgis": "f.eks. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Title", "serviceTitlePlaceholder": "type a title", diff --git a/web/client/translations/data.de-DE.json b/web/client/translations/data.de-DE.json index 93e34246d9..dc778cb373 100644 --- a/web/client/translations/data.de-DE.json +++ b/web/client/translations/data.de-DE.json @@ -1642,6 +1642,18 @@ "servicePlaceholder": "Geben Sie einen Service ein", "url": "Url", "urlPlaceholder": "Geben Sie eine URL ein", + "urlPlaceHolders": { + "wfs": "z.B. https://mydomain.com/geoserver/wfs", + "wmts": "z.B. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "z.B. https://mydomain.com/geoserver/wms", + "csw": "z.B. https://mydomain.com/geoserver/csw", + "tms": "z.B. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "z.B. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "z.B. https://mydomain.com/tileset.json", + "cog": "z.B. https://mydomain.com/cog.tif", + "model": "z.B. https://mydomain.com/filename.ifc", + "arcgis": "z.B. https://mydomain.com/arcgis/rest/services" + }, "type": "Typ", "serviceTitle": "Titel", "serviceTitlePlaceholder": "Geben Sie einen Titel ein", diff --git a/web/client/translations/data.en-US.json b/web/client/translations/data.en-US.json index 142808850b..01ba6c743e 100644 --- a/web/client/translations/data.en-US.json +++ b/web/client/translations/data.en-US.json @@ -1603,6 +1603,18 @@ "servicePlaceholder": "type a service", "url": "URL", "urlPlaceholder": "type a URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Title", "serviceTitlePlaceholder": "type a title", diff --git a/web/client/translations/data.es-ES.json b/web/client/translations/data.es-ES.json index 8cf00a2f41..25533a1267 100644 --- a/web/client/translations/data.es-ES.json +++ b/web/client/translations/data.es-ES.json @@ -1604,6 +1604,18 @@ "service": "Servicio", "url": "Url", "urlPlaceholder": "escribe la URL", + "urlPlaceHolders": { + "wfs": "p.ej. https://mydomain.com/geoserver/wfs", + "wmts": "p.ej. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "p.ej. https://mydomain.com/geoserver/wms", + "csw": "p.ej. https://mydomain.com/geoserver/csw", + "tms": "p.ej. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "p.ej. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "p.ej. https://mydomain.com/tileset.json", + "cog": "p.ej. https://mydomain.com/cog.tif", + "model": "p.ej. https://mydomain.com/filename.ifc", + "arcgis": "p.ej. https://mydomain.com/arcgis/rest/services" + }, "type": "Tipo", "serviceTitle": "Título", "serviceTitlePlaceholder": "escribe un título", diff --git a/web/client/translations/data.fi-FI.json b/web/client/translations/data.fi-FI.json index 1c50b8c287..22933299c4 100644 --- a/web/client/translations/data.fi-FI.json +++ b/web/client/translations/data.fi-FI.json @@ -1198,6 +1198,18 @@ "servicePlaceholder": "kirjoita palvelu", "url": "URL", "urlPlaceholder": "kirjoita URL-osoite", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Tyyppi", "serviceTitle": "Otsikko", "serviceTitlePlaceholder": "kirjoita otsikko", diff --git a/web/client/translations/data.fr-FR.json b/web/client/translations/data.fr-FR.json index dd4c09fbb2..660421ef98 100644 --- a/web/client/translations/data.fr-FR.json +++ b/web/client/translations/data.fr-FR.json @@ -1604,6 +1604,18 @@ "servicePlaceholder": "Tapez un service", "url": "URL", "urlPlaceholder": "tapez une URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Titre", "serviceTitlePlaceholder": "tapez un titre", diff --git a/web/client/translations/data.hr-HR.json b/web/client/translations/data.hr-HR.json index ab967049f4..546c987c39 100644 --- a/web/client/translations/data.hr-HR.json +++ b/web/client/translations/data.hr-HR.json @@ -1156,6 +1156,18 @@ "servicePlaceholder": "unesi servis", "url": "Url", "urlPlaceholder": "unesi URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Tip", "serviceTitle": "Naslov", "serviceTitlePlaceholder": "unesi naslov", diff --git a/web/client/translations/data.is-IS.json b/web/client/translations/data.is-IS.json index 7fae728924..59410039b4 100644 --- a/web/client/translations/data.is-IS.json +++ b/web/client/translations/data.is-IS.json @@ -1481,6 +1481,18 @@ "servicePlaceholder": "type a service", "url": "URL", "urlPlaceholder": "type a URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Title", "serviceTitlePlaceholder": "type a title", diff --git a/web/client/translations/data.it-IT.json b/web/client/translations/data.it-IT.json index 18064a3674..af17ce1603 100644 --- a/web/client/translations/data.it-IT.json +++ b/web/client/translations/data.it-IT.json @@ -1603,6 +1603,18 @@ "servicePlaceholder": "seleziona un servizio", "url": "Url", "urlPlaceholder": "inserisci un url", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Tipo", "serviceTitle": "Titolo", "serviceTitlePlaceholder": "inserisci un titolo", diff --git a/web/client/translations/data.nl-NL.json b/web/client/translations/data.nl-NL.json index 5b5e48d667..48db02684a 100644 --- a/web/client/translations/data.nl-NL.json +++ b/web/client/translations/data.nl-NL.json @@ -1597,6 +1597,18 @@ "servicePlaceholder": "typ een service", "url": "URL", "urlPlaceholder": "typ een URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "custom": "e.g. https://{s}.myUrl.com/{variant}/{z}/{x}/{y}", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Titel", "serviceTitlePlaceholder": "Typ een titel", diff --git a/web/client/translations/data.pt-PT.json b/web/client/translations/data.pt-PT.json index 8181ada449..6348e8e117 100644 --- a/web/client/translations/data.pt-PT.json +++ b/web/client/translations/data.pt-PT.json @@ -1133,6 +1133,17 @@ "servicePlaceholder": "type a service", "url": "Url", "urlPlaceholder": "type a URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Title", "serviceTitlePlaceholder": "type a title", diff --git a/web/client/translations/data.sk-SK.json b/web/client/translations/data.sk-SK.json index 658c7f8e63..6cef8bc8af 100644 --- a/web/client/translations/data.sk-SK.json +++ b/web/client/translations/data.sk-SK.json @@ -1412,6 +1412,17 @@ "servicePlaceholder": "Zadaj názov služby", "url": "URL", "urlPlaceholder": "Zadaj adresu URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Nadpis", "serviceTitlePlaceholder": "Zadaj nadpis", diff --git a/web/client/translations/data.sv-SE.json b/web/client/translations/data.sv-SE.json index c77073f50b..e5d1d6ccf3 100644 --- a/web/client/translations/data.sv-SE.json +++ b/web/client/translations/data.sv-SE.json @@ -1391,6 +1391,17 @@ "servicePlaceholder": "skriv en tjänst", "url": "URL", "urlPlaceholder": "skriv en webbadress", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Typ", "serviceTitle": "Titel", "serviceTitlePlaceholder": "skriv en titel", diff --git a/web/client/translations/data.vi-VN.json b/web/client/translations/data.vi-VN.json index 80cbc1703d..3f7ac1edf9 100644 --- a/web/client/translations/data.vi-VN.json +++ b/web/client/translations/data.vi-VN.json @@ -177,6 +177,17 @@ "type": "Loại", "url": "URL", "urlPlaceholder": "gõ một URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "wfsGetCapLink": "WFS", "wmsGetCapLink": "WMS" }, diff --git a/web/client/translations/data.zh-ZH.json b/web/client/translations/data.zh-ZH.json index 4f136adee9..2ae401434d 100644 --- a/web/client/translations/data.zh-ZH.json +++ b/web/client/translations/data.zh-ZH.json @@ -1110,6 +1110,17 @@ "servicePlaceholder": "type a service", "url": "Url", "urlPlaceholder": "type a URL", + "urlPlaceHolders": { + "wfs": "e.g. https://mydomain.com/geoserver/wfs", + "wmts": "e.g. https://mydomain.com/geoserver/gwc/service/wmts", + "wms": "e.g. https://mydomain.com/geoserver/wms", + "csw": "e.g. https://mydomain.com/geoserver/csw", + "tms": "e.g. https://mydomain.com/geoserver/gwc/service/tms/1.0.0", + "3dtiles": "e.g. https://mydomain.com/tileset.json", + "cog": "e.g. https://mydomain.com/cog.tif", + "model": "e.g. https://mydomain.com/filename.ifc", + "arcgis": "e.g. https://mydomain.com/arcgis/rest/services" + }, "type": "Type", "serviceTitle": "Title", "serviceTitlePlaceholder": "type a title",