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
mikihiir
Helper III
Helper III

LocalizationManager resources is undefined

Hei any idea why my localizationManager is not working ?

 

 

jant1.pngjant2.png

 

I have api version 2.3

 

 

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

Localization resources are not included if you run pbiviz start (debug visual).

To test localization you should generate a package by using pbiviz package and import it into Power BI.

 

Let us know if it resolves the issue.

 

image.png

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

View solution in original post

5 REPLIES 5
v-viig
Community Champion
Community Champion

Localization resources are not included if you run pbiviz start (debug visual).

To test localization you should generate a package by using pbiviz package and import it into Power BI.

 

Let us know if it resolves the issue.

 

image.png

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

@v-viig Do you have any idea if LocalizationManager resources will ever be available when running pbiviz start?  I have resources defined that have templating parameters for data substitution.  They don't work at all when I'm building the app, which means I really can't do localization.

 

For example, here's a templating string that I use for displaying dates:

en-US

"DateYMD": "{month} {day}, {year}",

ja-JP:

"DateYMD": "{year}年{month}月{day}日",

 

Obviously I format through the bracketed values to display dates for my supported languages, but I can't do this during development which is a real pain.  I know I can use moment.js for dates, but this is just one of many examples, most of which are not date-related.

 

Any news on this or recommended workarounds?

 

Chris

Hi Chris,

 

pbiviz start still doesn't support LocalizationManager and I'm unsure will it be in the future or not.

As I understand, your localization doesn't work at all even if you build a package an import it, correct?

If so, please send your source code to pbicvsupport@microsoft.com and I will look at it to find an issue.

 

Kind Regards,

Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visu


@v-evelk wrote:

As I understand, your localization doesn't work at all even if you build a package an import it, correct?

No, that's not quite accurate. If I build and import, then I can get the localized variables as expected. 

 

However, I write and debug the app in the developer visual.  While in the debugger visual, I make a localization request to get "DateYMD" and it returns "DateYMD" instead of "{month} {day}, {year}" for example.  My code relies on substituting the month value for {month}, the day value for {day} and the year value for {year} in the localized string so that I can properly display dates. 

 

As I mentioned, date display is only one example, and I have other needs to change strings based on current user locale.

 

However, because I can't get a string back from localizationManager while in the developer visual that includes {month} {day} {year} my string substitution fails.

 

A potential workaround would be to only return en-US or some other default locale while in the developer visual.  That would give me at least some data to work with.  The only thing I can think of now is to name the field something like {month}{day}{year} which seems wierd but maybe that would work.

 

Chris

Ok, got it now!

 

You could provide some checks before formatting and substitution applying to avoid failures (as checking that string contains "{}")?

Yes, labels will be looked ugly, but your code will work under any conditions.

 

Kind Regards,

 

Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com

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.