Setup the Language for “pac power-fx” in VSCode Terminal

A very short troubleshooting blog for today. I was very happy when I saw Daniel Laskewitz’s post, about the “Power Platform CLI: September Release”. Especially the “pac power-fx” looks awesome. I can imagine using it a lot in the future; right from inside my tools I use every day, without having to leave Visual Studio Code.

Inside my standalone “pac cli”, “pac power-fx” was available, but somehow doesn’t worked. But after a few days the power-fx command was available in the VSCode Extension. Was very exciting to try the commands, and see that we can interact with Dataverse. You just need:

pac power-fx repl
Accounts

… and you see the data

But of course the next step was to try to find specific records. Unfortunately I wasn’t able to use Filter or Find functions. I was getting some parsing errors, like this ones

I thought it was a bug, since the feature was just released. So I’ve waited a little more.

Today I saw also the official Power Platform announcement: https://devblogs.microsoft.com/powerplatform/power-platform-command-line-interface-september-update/ and a youtube video by Daniel Laskewitz, so I’ve started to have doubts, if it’s a bug or not. I still got the errors. BUT then I’ve realized that I have an issue with the PowerFx language. It seems that it’s considering “german” as my “Power Fx language”.

Filter(Contacts, “Coffee” in name) doesn’t work
Filter(Contacts ; “Coffee” in name) works 😍

Ok, now I know what’s about, so I can deal with that.

How to fix the language

As a pro-dev, I cannot deal with the “Power Fx in another language”. I can never get used to “;” instead of “,” to separate the function parameters. It’s not about low-code, but after writing code for some many years in other programming languages, it’s a torture to force me to write “Filter(Account; condition)”.

Canvas Apps Power Fx language

First thing when I’ve started with Canvas Apps was to change the language to english. By the way, it’s not enough to change the Power Apps user language, you need to change the language in your browser. Find more infos here (the docs), or have a look to this thread from the Power Apps Comunity Forum.

Power Platform CLI language

I had some problems with the “pac cli” language in the past too. I wanted to have the commands description in english (to be able to make some demos everybody understands) . I have an older blog about troubleshooting “pac cli” inside VSCode . But the extension get updates, and it’s not an option to have to change the settings after each update. So, back then I’ve changed the Windows-Language to english. Not the ideal solution, but it works.

The solution

Ok, so I had everything in english: my environment, my browser, my Windows, my pac cli, my VSCode (all Menus were in english, even the answer in Terminal). What else could be the cause? It turned out, that the VSCode Terminal was “running” in german. I could find the fix on StackOverflow: https://stackoverflow.com/questions/55508152/how-to-set-visual-studio-code-terminal-output-to-english

I’ve used the steps

  1. type “set-culture -cultureinfo en-US”, in Terminal
  2. restart VSCode
  3. type “get-culture” in terminal, to confirm the change

Now it works also in english:

Hope it helps!

Small remark – using logicalName

By the way, it seems that with “pac power-fx” we can use the logicalName for columns (in this example the “name” is the logicalName of the column). I don’t know if everybody is happy with that, but I absolutely love that: is the way we deal with webAPI, form-scripting and so on, so it’s natural for a pro-dev. Thank you for that! 😍

Original Photo by 100 files: https://www.pexels.com/photo/boy-in-mechanic-technician-uniform-with-wrench-standing-in-studio-5649068/

3 thoughts on “Setup the Language for “pac power-fx” in VSCode Terminal

Add yours

  1. Thanks for the great tip.
    Another option is to change the region settings in the Control Panel:

    Control Panel > Region > Additional settings>.
    Set Decimal symbol from , to .
    Set Digit grouping symbol from . to ,
    Set list separator from ; to , (this will also solve the problem with the wrong separator in csv-files)
    Click Apply.

    This way German can still be used as the display language.

  2. Why are you the person discovering and documenting this? Doesn’t this reflect poorly on Microsoft and their lack of proper documentation?

Leave a comment

Website Powered by WordPress.com.

Up ↑