In computer terms culture refers to how things like numbers, dates and currencies are formatted – among other things. It can have a big impact on how things look on screen or how they can be input. PowerShell V2 has introduced a whole raft of features to "internationalise" the input and output. Before looking at that in a future post we will look at what we can discover about the current culture on our machines.
I run Windows Vista and as I live in England I use English (United Kingdom) for my language settings.
This refers to CTP 2
PowerShell has 2 automatic (i.e. built in) variables related to culture
PS> $PSCulture
en-GB
PS> $PSUICulture
en-US
Note that $PSCulture returns en-GB (UK English) but $PSUICulture returns en-US (USA English)
$PSCulture = name of the culture currently in use within the OS and determines display format for numbers, currency and dates etc
$PsUICulture = UI Culture in use in the OS and determines which text strings are user for user interface elements such as menus and messages
PS> get-date "12/31/2008"
Get-Date : Cannot bind parameter ‘Date’. Cannot convert value "12/31/2008" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
At line:1 char:9
+ get-date <<<< "12/31/2008"
PS> get-date "31/12/2008"
31 December 2008 00:00:00
Shows that UK rather than US date formats are in use – which matches with the culture information
Note that culture settings cannot be changed with PowerShell.
More information can be found using a couple of cmdlets.
PS> Get-Culture | Format-List
Parent : en
LCID : 2057
KeyboardLayoutId : 2057
Name : en-GB
IetfLanguageTag : en-GB
DisplayName : English (United Kingdom)
NativeName : English (United Kingdom)
EnglishName : English (United Kingdom)
TwoLetterISOLanguageName : en
ThreeLetterISOLanguageName : eng
ThreeLetterWindowsLanguageName : ENG
CompareInfo : CompareInfo – 2057
TextInfo : TextInfo – 2057
IsNeutralCulture : False
CultureTypes : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat : System.Globalization.NumberFormatInfo
DateTimeFormat : System.Globalization.DateTimeFormatInfo
Calendar : System.Globalization.GregorianCalendar
OptionalCalendars : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride : True
IsReadOnly : False
PS> Get-UICulture | Format-List
Parent : en
LCID : 1033
KeyboardLayoutId : 1033
Name : en-US
IetfLanguageTag : en-US
DisplayName : English (United States)
NativeName : English (United States)
EnglishName : English (United States)
TwoLetterISOLanguageName : en
ThreeLetterISOLanguageName : eng
ThreeLetterWindowsLanguageName : ENU
CompareInfo : CompareInfo – 1033
TextInfo : TextInfo – 1033
IsNeutralCulture : False
CultureTypes : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat : System.Globalization.NumberFormatInfo
DateTimeFormat : System.Globalization.DateTimeFormatInfo
Calendar : System.Globalization.GregorianCalendar
OptionalCalendars : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride : True
IsReadOnly : False
Note the differences – especially in the Keyboard layout and comparison properties