diff client/src/components/identify/formatter.js @ 4258:57c38087fe18

client: correct strings-marking for translations (identify box)
author Fadi Abbud <fadi.abbud@intevation.de>
date Mon, 26 Aug 2019 12:49:59 +0200
parents f3b733fd119a
children 1604284d2597
line wrap: on
line diff
--- a/client/src/components/identify/formatter.js	Sat Aug 24 17:39:05 2019 +0200
+++ b/client/src/components/identify/formatter.js	Mon Aug 26 12:49:59 2019 +0200
@@ -1,11 +1,12 @@
 import Feature from "ol/Feature";
+import app from "@/main";
 
 const formatter = {
   all(p) {
-    if (p.key === "objnam") p.key = "Name";
-    if (p.key === "objname") p.key = "Name";
+    if (p.key === "objnam") p.key = app.$gettext("Name");
+    if (p.key === "objname") p.key = app.$gettext("Name");
     if (p.key === "staging_done" || p.key === "fa_critical")
-      p.val = p.val ? "yes" : "no";
+      p.val = p.val ? app.$gettext("yes") : app.$gettext("no");
     if (
       (p.key === "date_info" ||
         p.key === "fa_date_info" ||
@@ -22,17 +23,21 @@
     return p;
   },
   bottlenecks_geoserver: {
-    label: "Bottleneck",
+    label: app.$gettext("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";
+      if (p.key === "responsible_country")
+        p.key = app.$gettext("Responsible Country");
+      if (p.key === "fa_date_info") p.key = app.$gettext("Fairway Date");
+      if (p.key === "fa_critical") p.key = app.$gettext("Fairway Critical");
+      if (p.key === "gauge_objname") p.key = app.$gettext("Reference Gauge");
+      if (p.key === "source_organization")
+        p.key = app.$gettext("Source Organization");
+      if (p.key === "gm_measuredate")
+        p.key = app.$gettext("Gauge Waterlevel Date");
+      if (p.key === "gm_waterlevel") p.key = app.$gettext("Gauge Waterlevel");
+      if (p.key === "gm_n_14d")
+        p.key = app.$gettext("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
@@ -48,47 +53,53 @@
     }
   },
   fairway_dimensions: {
-    label: "Fairway Dimensions"
+    label: app.$gettext("Fairway Dimensions")
   },
   waterway_area: {
-    label: "Waterway Area"
+    label: app.$gettext("Waterway Area")
   },
   distance_marks_geoserver: {
-    label: "Distance Mark"
+    label: app.$gettext("Distance Mark")
   },
   distance_marks_ashore_geoserver: {
-    label: "Distance Mark ashore"
+    label: app.$gettext("Distance Mark ashore")
   },
   waterway_axis: {
-    label: "Waterway Axis"
+    label: app.$gettext("Waterway Axis")
   },
   waterway_profiles: {
-    label: "Waterway Profile"
+    label: app.$gettext("Waterway Profile")
   },
   stretches_geoserver: {
-    label: "Stretch",
+    label: app.$gettext("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";
+      if (p.key === "gm_measuredate")
+        p.key = app.$gettext("Min. Gauge Waterlevel Date");
+      if (p.key === "gm_n_14d")
+        p.key = app.$gettext("Min. G.W. Count in Last 14 Days");
 
       return p;
     }
   },
   sections_geoserver: {
-    label: "Section",
+    label: app.$gettext("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";
+      if (p.key === "gm_measuredate")
+        p.key = app.$gettext("Min. Gauge Waterlevel Date");
+      if (p.key === "gm_n_14d")
+        p.key = app.$gettext("Min. G.W. Count in Last 14 Days");
 
       return p;
     }
   },
   gauges_geoserver: {
-    label: "Gauge",
+    label: app.$gettext("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";
+      if (p.key === "gm_measuredate")
+        p.key = app.$gettext("Latest Waterlevel Date");
+      if (p.key === "gm_waterlevel") p.key = app.$gettext("Latest Waterlevel");
+      if (p.key === "gm_n_14d")
+        p.key = app.$gettext("Measurement Count in Last 14 Days");
 
       // remove certain props
       let propsToRemove = ["nsc_data"];