Mercurial > gemma
view client/src/components/identify/formatter.js @ 4231:6f31a99cd92d
clinet: fix translations process and update source strings
* move strings for translations from *.po files to the component itself to let gettext() mark only the strings without the html elements.
(make makemessages complains to have html elements in the .po files and stops the process).
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Wed, 21 Aug 2019 11:13:12 +0200 |
parents | f3b733fd119a |
children | 57c38087fe18 |
line wrap: on
line source
import Feature from "ol/Feature"; const formatter = { all(p) { if (p.key === "objnam") p.key = "Name"; if (p.key === "objname") p.key = "Name"; if (p.key === "staging_done" || p.key === "fa_critical") p.val = p.val ? "yes" : "no"; if ( (p.key === "date_info" || p.key === "fa_date_info" || p.key === "gm_measuredate") && p.val !== null ) { p.val = new Date(p.val).toLocaleString(); } // remove certain props let propsToRemove = ["bbox"]; if (propsToRemove.indexOf(p.key) !== -1) return null; return p; }, bottlenecks_geoserver: { label: "Bottleneck", props: p => { if (p.key === "bottleneck_id") p.key = "ID"; if (p.key === "responsible_country") p.key = "Responsible Country"; if (p.key === "fa_date_info") p.key = "Fairway Date"; if (p.key === "fa_critical") p.key = "Fairway Critical"; if (p.key === "gauge_objname") p.key = "Reference Gauge"; if (p.key === "source_organization") p.key = "Source Organization"; if (p.key === "gm_measuredate") p.key = "Gauge Waterlevel Date"; if (p.key === "gm_waterlevel") p.key = "Gauge Waterlevel"; if (p.key === "gm_n_14d") p.key = "G.W. Count in Last 14 Days"; // remove certain props // * gauge_obj is another feature object and we want to stay flat // for display (if left in causes a // TypeError: Converting circular structure to JSON // somewhere later) if (p.val instanceof Feature) { return null; } let propsToRemove = ["nobjnm", "reference_water_levels", "fa_data"]; if (propsToRemove.indexOf(p.key) !== -1) return null; return p; } }, fairway_dimensions: { label: "Fairway Dimensions" }, waterway_area: { label: "Waterway Area" }, distance_marks_geoserver: { label: "Distance Mark" }, distance_marks_ashore_geoserver: { label: "Distance Mark ashore" }, waterway_axis: { label: "Waterway Axis" }, waterway_profiles: { label: "Waterway Profile" }, stretches_geoserver: { label: "Stretch", props: p => { if (p.key === "gm_measuredate") p.key = "Min. Gauge Waterlevel Date"; if (p.key === "gm_n_14d") p.key = "Min. G.W. Count in Last 14 Days"; return p; } }, sections_geoserver: { label: "Section", props: p => { if (p.key === "gm_measuredate") p.key = "Min. Gauge Waterlevel Date"; if (p.key === "gm_n_14d") p.key = "Min. G.W. Count in Last 14 Days"; return p; } }, gauges_geoserver: { label: "Gauge", props: p => { if (p.key === "gm_measuredate") p.key = "Latest Waterlevel Date"; if (p.key === "gm_waterlevel") p.key = "Latest Waterlevel"; if (p.key === "gm_n_14d") p.key = "Measurement Count in Last 14 Days"; // remove certain props let propsToRemove = ["nsc_data"]; if (propsToRemove.indexOf(p.key) !== -1) return null; return p; } } }; export { formatter };