wri / gfw-mapbuilder

Template for the GFW Map Builder that is available through ArcGIS Online, as a stand-alone web application, & a library to build custom Forest Atlas web applications
https://my.gfw-mapbuilder.org/v1.latest/
MIT License
32 stars 10 forks source link

If pop-up is configured through layer panel, clicking on shape returns layer name in wrong language when app is in secondary language. #660

Closed richardbarad closed 4 years ago

richardbarad commented 4 years ago

Describe the bug

If a pop-up is configured for a layer through layer panel, clicking on shape returns the layer name in wrong language when app is in secondary language.

To Reproduce Steps to reproduce the behavior:

  1. Go to http://blueraster.teaches-yoga.com/GEO?l=en (make sure app is in English)

  2. Click on a shape from the protected area layer (i.e: the polygon shown in the screenshot below)

2019-11-04 12_46_00-Window

Expected behavior

The layer name in the layer drop-down should show in English since the application language is currently set to English. Currently, it shows the name of the layer in Georgian as shown in the screenshot below.

Screenshots

Language_BUg

Desktop (please complete the following information):

csphang commented 4 years ago

@richardbarad Can you clarify what popup configuration through the layer panel means? We noticed this pop-up behavior doesn't occur with Cameroon's secondary language

richardbarad commented 4 years ago

@csphang. We support adding a pop-up for a layer configured through the Layer Panel in a non webmap group and our Georgia application makes heavy use of this since it contains multiple groups with custom layers. The Cameroon layers seem to not be impacted because all the layers with pop-ups come from the webmap group instead of the layers in the configuration panel.

For example, the JSON below shows the configuration for our Protected Areas layer in the Georgia Atlas. When I click on a protected area I see the Georgian label text instead of the English text even through the language is set to English.

Let me know if you need additional information.

      {
        "order": 5,
        "id": "PA",
        "type": "dynamic",
        "visible": true,
        "url": "https://gis.mepa.gov.ge/server/rest/services/atlas/protected_areas/MapServer",
        "layerIds": [
          4
        ],
        "label": {
          "en": "Protected Areas",
          "ka": "დაცული ტერიტორიები"
        },
        "filterField": {
          "en": "Category_EN",
          "ka": "Category_KA"
        },
        "filterLabel": {
          "en": "Filter by Category",
          "ka": "ფილტრი კატეგორიების მიხედვით"
        },
        "popup": {
          "title": {
            **"en": "Protected Areas",
            "ka": "კატეგორიები"**
          },
          "content": {
            "ka": [
              {
                "label": "დაცული ტერიტორია",
                "fieldExpression": "Protected_Areas_KA"
              },
              {
                "label": "დაარსების წელი",
                "fieldExpression": "Year_of_Establishment_KA"
              },
              {
                "label": "ადმინისტრაცია",
                "fieldExpression": "Administration_KA"
              },
              {
                "label": "კატეგორია",
                "fieldExpression": "Category_KA"
              },
              {
                "label": "ფართობი ჰა",
                "fieldExpression": "PA_Area_ha_KA"
              }
            ],
            "en": [
              {
                "label": "Protected Area Name",
                "fieldExpression": "Protected_Areas_EN"
              },
              {
                "label": "Year of Establishment",
                "fieldExpression": "Year_of_Establishment_KA"
              },
              {
                "label": "Administration",
                "fieldExpression": "Administration_EN"
              },
              {
                "label": "Category",
                "fieldExpression": "Category_EN"
              },
              {
                "label": "Area (ha)",
                "fieldExpression": "PA_Area_ha_KA"
              }
            ]
          }
        }
      }
SwampGuzzler commented 4 years ago

@csphang Can we talk about features in InfoWindow getting cleared out on language-toggle?

csphang commented 4 years ago

@SwampGuzzler we can proceed with closing the infowindow when a user switches languages

SwampGuzzler commented 4 years ago

@csphang Check this out here: http://alpha.blueraster.io/gfw-mapbuilder/660-language-toggle-update/

csphang commented 4 years ago

@richardbarad I reviewed the updated build and believe it's ready for your review. This url encompasses updates to the attribute info window in regards to language toggling: http://alpha.blueraster.io/gfw-mapbuilder/660-language-toggle-update/

richardbarad commented 4 years ago

@csphang. It looks like the update is not working for point layers. It works for polygon and line.

To see this:

1) Set the language to English 2) Clear all layers 3) Turn on the following two layers:

a) Protected Areas - Infrastructure of Protected Areas b) Biodiversity - EUNIS Habitats (first layer in Biodiversity group)

4) Click on a point. The text for the layer name will be in Georgian instead of English as shown in the screenshoot below.

Infrastructure_ProtectedAreas EUNIS_Habitat

Interestingly, it is working correctly for Fires though in which the pop-up is also configured through the configuration.

csphang commented 4 years ago

Hi @richardbarad - We discovered this issue was occurring with layers containing a layerId of 0. We've updated the code and this is ready for your testing. You can use the same URL as before! http://alpha.blueraster.io/gfw-mapbuilder/660-language-toggle-update/

richardbarad commented 4 years ago

@csphang. Looks good!