Skip to content

Commit

Permalink
Catalog editor i18n (geosolutions-it#10571)
Browse files Browse the repository at this point in the history
  • Loading branch information
tha-nordiq authored and offtherailz committed Oct 21, 2024
1 parent 453cd13 commit b16b74a
Show file tree
Hide file tree
Showing 18 changed files with 180 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(<CatalogServiceEditor
service={givenWmsService}
Expand Down
10 changes: 5 additions & 5 deletions web/client/components/catalog/editor/MainForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import InfoPopover from '../../widgets/widget/InfoPopover';
import { FormControl as FC, Form, Col, FormGroup, ControlLabel, Alert } from "react-bootstrap";

import localizedProps from '../../misc/enhancers/localizedProps';
import {defaultPlaceholder, checkUrl} from "./MainFormUtils";
import {checkUrl} from "./MainFormUtils";

const FormControl = localizedProps('placeholder')(FC);

Expand All @@ -35,7 +35,7 @@ const DefaultURLEditor = ({ service = {}, onChangeUrl = () => { } }) => {
style={{
textOverflow: "ellipsis"
}}
placeholder={defaultPlaceholder(service)}
placeholder={'catalog.urlPlaceHolders.' + service.type}
value={service && service.url}
onChange={(e) => onChangeUrl(e.target.value)}/>
</Col>
Expand Down Expand Up @@ -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)} />
</React.Fragment>
Expand All @@ -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)} />
</React.Fragment>
Expand All @@ -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 || "";
Expand Down
21 changes: 0 additions & 21 deletions web/client/components/catalog/editor/MainFormUtils.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.is-IS.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions web/client/translations/data.nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions web/client/translations/data.pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions web/client/translations/data.sk-SK.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions web/client/translations/data.sv-SE.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions web/client/translations/data.vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
11 changes: 11 additions & 0 deletions web/client/translations/data.zh-ZH.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b16b74a

Please sign in to comment.