internal/Get-Language.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function Get-Language {
    <#
  .SYNOPSIS
   Converts Microsoft's language ID to human readable format
 
  .DESCRIPTION
   Converts Microsoft's language ID to human readable format
 
  .PARAMETER Id
   The language ID
 
  .EXAMPLE
   Get-Language 1033
 
   Returns a pscustomobject with id, alias and name
 #>

    [CmdletBinding()]
    param (
        [int]$id
    )
    process {
        
        $culture = [System.Globalization.CultureInfo]::GetCultureInfo($id)
        
        $excludeProps = 'Parent','IetfLanguageTag','CompareInfo','TextInfo','IsNeutralCulture','NumberFormat','DateTimeFormat','Calendar'
            ,'OptionalCalendars','UseUserOverride','IsReadOnly'
        Select-DefaultView -InputObject $culture -ExcludeProperty $excludeProps
    }
}