META: What are the features needed to improve PowerShell localization
Summary of the new feature / enhancement
We should think through the features that PowerShell needs to improve its localization story. #14992 #17740 #8219 #6217 #5390 #666
these are some of the issues that are related to this
Proposed technical implementation details (optional)
No response
A common argument people use against using localized software is that it makes it harder to look up errors and I think that's a valid point. I think there are 2 changes that could be made to address this complaint:
- A preference variable to set the desired language for errors (People may still want localized dates and numbers so it shouldn't just change the whole culture to the specified language).
- A command to convert an error record to a different culture, like:
Get-Error | Get-LocalizedError -TargetCulture en-US.
Some people may also want to run PowerShell in English but keep the OS localized but there's no easy way to change the culture on the fly. The following reflection code seems to do the trick but a proper command would be better:
$culture = [System.Globalization.CultureInfo]::CreateSpecificCulture("en-US")
$assembly = [System.Reflection.Assembly]::Load("System.Management.Automation")
$type = $assembly.GetType("Microsoft.PowerShell.NativeCultureResolver")
$field = $type.GetField("m_uiCulture", [Reflection.BindingFlags]::NonPublic -bor [Reflection.BindingFlags]::Static)
$field.SetValue($null, $culture)
Hi all, could you please share with me how I can get the DLL for other language resources in PowerShell.SDK ? I am using the powershell.sdk 7.2.0 for my c# program, Thanks.