Skip to content

Instantly share code, notes, and snippets.

@scriptingstudio
Last active October 17, 2026 10:42
Show Gist options
  • Select an option

  • Save scriptingstudio/6993692e9246d64e0e81b77c237d45a7 to your computer and use it in GitHub Desktop.

Select an option

Save scriptingstudio/6993692e9246d64e0e81b77c237d45a7 to your computer and use it in GitHub Desktop.
PowerShell culture selector
function New-Culture ([string]$name, [int]$lcid, [switch]$list) {
if ($list) {
return [cultureinfo]::GetCultures([System.Globalization.CultureTypes]::AllCultures)
}
if (-not $name -and $lcid -lt 1) {return Get-Culture}
if (-not $name) {$name = 'zzzzzzzzz'}
[cultureinfo]::GetCultures([System.Globalization.CultureTypes]::AllCultures) |
Where-Object {$_.name -eq $name -or $lcid -eq $_.lcid}
} # END New-Culture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment