Forum Discussion

timseltman's avatar
timseltman
Frequent Visitor
3 years ago
Solved

Unable to implement localization within a Custom Visual

I am trying to implement localization within a propriatary custom visual. However I was able to reproduce the issue within a starter custom visual which you can find in this github:

 

Sandbox-PowerBI-Localization/localization at main · TimSeltmanJinett/Sandbox-PowerBI-Localization (github.com)

 

Basically I am following the instructions for implementing localization from the main wiki page:

 

Add the locale in Power BI for Power BI visuals - Power BI | Microsoft Learn

 

However, the localization manager does not seem to be pulling the displayNameKey; nor the descriptionKey; ids assigned to the dataRoles in the capabilities.json nor the settings.ts file, correctly. Instead I get this:

 

I have done the following steps:

  • Set up a localization manager, and initializing it within the constructor
  • Add the localization manager to the FormattingSettingsService
  • Add "displayNameKey" and "descriptionKey" to each dataRole within the capabilities.json file as well as within each slicer of the setting cards.
  • Created a "stringResources" folder; added both a "us-EN" and "es-ES" subfolders.
  • Within each sub-folder added a "resources.resjson" file that contains the "displayNameKey" and "descriptionKey" label associates based on the language.
  • Added relative links to the "resources.resjson" files in the "stringResources" variable within the "pbiviz.json" file.

I'm unsure what I am doing wrong. I tried looking at other microsoft repositories and they appear to be doing the same thing I was doing:

 

microsoft/powerbi-visuals-heatmap: powerbi-visuals-heatmap (github.com)

 

Any help would be most appreciative.

  • Hi timseltman - are you looking at the developer visual or the packaged visual? Historically, this has only worked when you package the visual and test that.

    It looked like they recently made a change in powerbi-visuals-tools 4.0.7 to try and support this, but quickly rolled it back due to vulnerabilities, so may appear again in the near future.

    Regards,.

    Daniel

3 Replies

  • dm-p's avatar
    dm-p
    Super User

    Hi timseltman - are you looking at the developer visual or the packaged visual? Historically, this has only worked when you package the visual and test that.

    It looked like they recently made a change in powerbi-visuals-tools 4.0.7 to try and support this, but quickly rolled it back due to vulnerabilities, so may appear again in the near future.

    Regards,.

    Daniel

    • timseltman's avatar
      timseltman
      Frequent Visitor

      I am working with the developer visual and have not tested as a package. I am working with powerbi-visuals-tools version 4.0.8; along with upgrading all modules to their latest version (including powerbi-visuals-api to 5.2.0). I will attempt to test this tomorrow and I'll let you know the result.

    • timseltman's avatar
      timseltman
      Frequent Visitor

      After testing this morning, you are correct. It appears that in order to test if the localization is working, I have to package the visual and test it as if it is the final product. It does not appear that the description key is working though (nothing happens when I hover over the labels; even though I have set up description keys for each), so I may have to default that to English for the time being. But otherwise this just adds to the testing of the program. Either way this answers my question. Hopefully in the future, description keys work properly and we are able to test localization in developer view.

       

      Edit: after further testing, the hovering appears to be weird when using English. In Spanish, the hover works just fine, but not so in English. Nothing appears when I hover over the labels. Not sure if it is a bug or what.