changeset 4989:f879933cf671

add formatting for captions of infos about fairway_marks
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 05 Mar 2020 14:05:45 +0100
parents 61eb65394a13
children 16259efa828f
files client/src/components/identify/Identify.vue client/src/components/importconfiguration/types/Fairwaymarks.vue
diffstat 2 files changed, 54 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue	Thu Mar 05 11:59:11 2020 +0100
+++ b/client/src/components/identify/Identify.vue	Thu Mar 05 14:05:45 2020 +0100
@@ -540,10 +540,43 @@
       return id.replace(/[.][^.]*$/, "");
     },
     featureLabel(feature) {
+      const featureID = this.featureId(feature);
       if (formatter.hasOwnProperty(this.featureId(feature))) {
-        return formatter[this.featureId(feature)].label;
+        return formatter[featureID].label;
+      }
+      if (/fairway_marks/.test(featureID)) {
+        return this.captionFairwayMarks(
+          featureID.replace("fairway_marks_", "")
+        );
       }
-      return this.featureId(feature);
+      return featureID;
+    },
+    captionFairwayMarks(id) {
+      const captions = {
+        bcnisd: this.$gettext(
+          "Beacon, isolated danger (MARITIME/Hydro feature)"
+        ),
+        bcnlat_hydro: this.$gettext("Beacon, lateral (MARITIME/Hydro feature)"),
+        bcnlat_ienc: this.$gettext("Beacon, lateral (IENC feature)"),
+        boycar: this.$gettext("Buoy, cardinal (MARITIME/Hydro feature)"),
+        boyisd: this.$gettext("Buoy, isolated danger (MARITIME/Hydro feature)"),
+        boylat_hydro: this.$gettext("Buoy, lateral (MARITIME/Hydro feature)"),
+        boylat_ienc: this.$gettext("Buoy, lateral (IENC feature)"),
+        boysaw: this.$gettext("Buoy, safe water (MARITIME/Hydro feature)"),
+        boyspp: this.$gettext(
+          "Buoy, special purpose/general (MARITIME/Hydro feature)"
+        ),
+        daymar_hydro: this.$gettext("Daymark (MARITIME/Hydro feature)"),
+        daymar_ienc: this.$gettext("Daymark (IENC feature)"),
+        lights: this.$gettext("Light (MARITIME/Hydro feature)"),
+        rtpbcn: this.$gettext(
+          "Radar transponder beacon (MARITIME/Hydro feature)"
+        ),
+        topmar: this.$gettext("Topmark (MARITIME/Hydro feature)"),
+        notmrk: this.$gettext("Notice mark (IENC feature)")
+      };
+      if (captions[id]) return captions[id];
+      return id;
     },
     featureProps(feature) {
       let featureId = this.featureId(feature);
--- a/client/src/components/importconfiguration/types/Fairwaymarks.vue	Thu Mar 05 11:59:11 2020 +0100
+++ b/client/src/components/importconfiguration/types/Fairwaymarks.vue	Thu Mar 05 14:05:45 2020 +0100
@@ -98,6 +98,8 @@
  * Author(s):
  * Thomas Junk <thomas.junk@intevation.de>
  */
+import app from "@/main";
+
 export default {
   name: "fairwaymarks",
   props: ["url", "featureType", "sortBy", "mark", "isUpdate"],
@@ -124,21 +126,23 @@
     }
   },
   FAIRWAYMARKS: {
-    BCNISD: "Beacon, isolated danger (MARITIME/Hydro feature)",
-    BCNLAT_hydro: "Beacon, lateral (MARITIME/Hydro feature)",
-    bcnlat_ienc: "Beacon, lateral (IENC feature)",
-    BOYCAR: "Buoy, cardinal (MARITIME/Hydro feature)",
-    BOYISD: "Buoy, isolated danger (MARITIME/Hydro feature)",
-    BOYLAT_hydro: "Buoy, lateral (MARITIME/Hydro feature)",
-    BOYLAT_ienc: "Buoy, lateral (IENC feature)",
-    BOYSAW: "Buoy, safe water (MARITIME/Hydro feature)",
-    BOYSPP: "Buoy, special purpose/general (MARITIME/Hydro feature)",
-    DAYMAR_hydro: "Daymark (MARITIME/Hydro feature)",
-    DAYMAR_ienc: "Daymark (IENC feature)",
-    LIGHTS: "Light (MARITIME/Hydro feature)",
-    RTPBCN: "Radar transponder beacon (MARITIME/Hydro feature)",
-    TOPMAR: "Topmark (MARITIME/Hydro feature)",
-    notmrk: "Notice mark (IENC feature)"
+    bcnisd: app.$gettext("Beacon, isolated danger (MARITIME/Hydro feature)"),
+    bcnlat_hydro: app.$gettext("Beacon, lateral (MARITIME/Hydro feature)"),
+    bcnlat_ienc: app.$gettext("Beacon, lateral (IENC feature)"),
+    boycar: app.$gettext("Buoy, cardinal (MARITIME/Hydro feature)"),
+    boyisd: app.$gettext("Buoy, isolated danger (MARITIME/Hydro feature)"),
+    boylat_hydro: app.$gettext("Buoy, lateral (MARITIME/Hydro feature)"),
+    boylat_ienc: app.$gettext("Buoy, lateral (IENC feature)"),
+    boysaw: app.$gettext("Buoy, safe water (MARITIME/Hydro feature)"),
+    boyspp: app.$gettext(
+      "Buoy, special purpose/general (MARITIME/Hydro feature)"
+    ),
+    daymar_hydro: app.$gettext("Daymark (MARITIME/Hydro feature)"),
+    daymar_ienc: app.$gettext("Daymark (IENC feature)"),
+    lights: app.$gettext("Light (MARITIME/Hydro feature)"),
+    rtpbcn: app.$gettext("Radar transponder beacon (MARITIME/Hydro feature)"),
+    topmar: app.$gettext("Topmark (MARITIME/Hydro feature)"),
+    notmrk: app.$gettext("Notice mark (IENC feature)")
   }
 };
 </script>