-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Get-Culture and $PSCulture do not (consistently) reflect in-session changes to another culture #3831
Copy link
Copy link
Closed
Labels
Breaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
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-USis the initial culture at session startup time. - differs between PowerShell Core and Windows PowerShell: in Core,
Get-Cultureand$host.CurrentCulturereflect the switch, but$PSCulturedoesn't, whereas in Windows PowerShell none of the PS cmdlets/properties do.
- assumes that
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
- Windows PowerShell 5.1
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)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Breaking-Changebreaking change that may affect usersbreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime