I tried to Set-Culture -CultureInfo vi-VN
but Powershell was not changed to my setted Culture.
I tested by open Powershell ISE and seen my setted Culture was changed successful.
How to make Powershell changes to my setted Culture?
Assuming you've started a new session (see below):
You may have run into a Windows PowerShell bug, present as of v5.1.18362.628):
Changing to culture vi-VN
(Vietnamese (Vietnam)
, LCID 1066
), specifically[1], doesn't seem to work in Windows PowerShell (v5.1-) in console windows[2] (whereas it does work in the obsolescent PowerShell ISE, as you state).
Note: The change does take effect for the current user account in general, but not in Windows PowerShell console windows.
PowerShell [Core] 6+ is not affected.
As for a potential fix: Windows PowerShell is no longer in active development, so only critical fixes are being implemented. You can report Windows PowerShell bugs in the relevant UserVoice forum.
Generally speaking:
Set-Culture
persistently changes the current user's culture system-wide.
This only takes effect in future PowerShell sessions (processes), so you'll have to open a new PowerShell console window, for instance, for the change to take effect.
As of this writing, the Set-Culture
help topic doesn't mention this requirement; fixing that is being suggested in this GitHub issue.
However, the taskbar's notification area will instantly reflect the new culture in its date and time display, and paying attention to that provides instant feedback as to whether the call succeeded in principle; e.g., if you run Set-Culture fr-FR
(French), the date and time changes to something like this ("jeudi" is French for Thursday):
To start a new session, do one of the following:
In Visual Studio Code with the PowerShell extension installed, terminate the PowerShell Integrated Console as shown below and opt to restart it when prompted (alternatively, start a new regular (non-integrated) PowerShell instance in the integrated terminal).
In the - obsolescent - ISE, open a new PowerShell tab (File > New PowerShell Tab
, Ctrl-T).
While a change is pending, i.e. before you've started a new session, Get-Culture
reports the still effective (old) value, not the pending one.
You need to pass the name of a predefined specific culture as the (implied) -CultureInfo
argument.
A specific culture has a name such as fr-FR
, where fr
designates the language (French) and FR
the location (region or country); by contrast, a language-only culture name such as fr
is not supported and quietly ignored.
To get the list of predefined specific cultures, run the following command or, for Windows only, consult this documentation:
[cultureinfo]::GetCultures('SpecificCultures')
[1] Not sure if other cultures are affected as well.
[2] Running in Windows Terminal doesn't help either. This suggests that the bug is inside the ConsoleHost
PowerShell host inside of which console-based PowerShell sessions run (whereas the ISE implements its own host, Windows PowerShell ISE Host
), as reflected in $HOST
.