Note: Perhaps this is by design (although there's at least a buggy inconsistency), given that there's currently no PowerShell mechanism for in-session switching to another culture. If so, it should at least be documented.
Steps to reproduce
[pscustomobject] @{ Test = 'initial'; Name = (Get-Culture).Name}
[cultureinfo]::currentculture = 'fr-FR'; [pscustomobject] @{ Test = '$PSCulture'; Name =$PSCulture }, [pscustomobject] @{ Test = 'GetCulture'; Name = (Get-Culture).Name }, [pscustomobject] @{ Test = '$host.CurrentCulture'; Name = $host.CurrentCulture.Name }, [pscustomobject] @{ Test = '.NET'; Name = [cultureinfo]::currentculture.name }
Note:
- If you try the above interactively, be sure to execute the 2nd line above on a single line.
- The output below:
- assumes that
en-US is the initial culture at session startup time.
- differs between PowerShell Core and Windows PowerShell: in Core,
Get-Culture and $host.CurrentCulture reflect the switch, but $PSCulture doesn't, whereas in Windows PowerShell none of the PS cmdlets/properties do.
Expected behavior
Test Name
---- ----
initial en-US
$PSCulture fr-FR
GetCulture fr-FR
$host.CurrentCulture fr-FR
.NET fr-FR
Actual behavior
- PowerShell Core: Windows, macOS, Ubuntu
Test Name
---- ----
initial en-US
$PSCulture en-US
GetCulture fr-FR
$host.CurrentCulture fr-FR
.NET fr-FR
Test Name
---- ----
initial en-US
$PSCulture en-US
GetCulture en-US
$host.CurrentCulture en-US
.NET fr-FR
Environment data
PowerShell Core v6.0.0-beta (v6.0.0-beta.1) on macOS 10.12.5
PowerShell Core v6.0.0-beta (v6.0.0-beta.1) on Ubuntu 16.04.1 LTS
PowerShell Core v6.0.0-beta (v6.0.0-beta.1) on Microsoft Windows 10 Pro (64-bit; v10.0.14393)
Windows PowerShell v5.1.14393.1198 on Microsoft Windows 10 Pro (64-bit; v10.0.14393)
Note: Perhaps this is by design (although there's at least a buggy inconsistency), given that there's currently no PowerShell mechanism for in-session switching to another culture. If so, it should at least be documented.
Steps to reproduce
Note:
en-USis the initial culture at session startup time.Get-Cultureand$host.CurrentCulturereflect the switch, but$PSCulturedoesn't, whereas in Windows PowerShell none of the PS cmdlets/properties do.Expected behavior
Actual behavior
Environment data