Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
timseltman
Frequent Visitor

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 (g...

 

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:

 

timseltman_0-1678388958247.png

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.

1 ACCEPTED SOLUTION
dm-p
Super User
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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

3 REPLIES 3
dm-p
Super User
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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




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.

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors