On a Windows 8.1 machine, I'm seeing many more available cultures than on a Windows Server 2012 machine: 791 vs 378. To give a specific example, the server machine is missing the 'en-HK' culture.
Here is the test code I'm using to enumerate them:
foreach (var ci in CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures).OrderBy(ci => ci.Name))
{
Console.WriteLine("{0} ({1})", ci.Name, ci.EnglishName);
}
Question: how can I install the more complete culture list on Windows Server 2012 so that it matches what's available on Windows 8.1?
Here's some Powershell I've used to add custom cultures to 2012. This is a hard-coded script (sorry, rough!). It bases a new culture ($newCulture
) on an existing one, in this case en-US.
This is based on sample C# code from MSDN, under "How To: Create Custom Cultures": https://msdn.microsoft.com/en-us/library/ms172469(v=vs.100).aspx
Hope it helps!
###################################
# Add-Culture
#
# Edit script to add a new custom culture
#
###################################
function Add-Culture($Servers, $Credential) {
Invoke-Command {
# Import System.Globalization
Add-Type -AssemblyName "sysglobl"
$newCulture = "en-TH"
# Create new CultureAndRegionInfoBuilder
$cib = New-Object "System.Globalization.CultureAndRegionInfoBuilder" -Args $newCulture, None
# Based on existing en-US culture
$ci = New-Object "System.Globalization.CultureInfo" -Args "en-US"
$ri = New-Object "System.Globalization.RegionInfo" -Args "th-TH"
$cib.LoadDataFromCultureInfo($ci)
$cib.LoadDataFromRegionInfo($ri)
# Set culture values here
# Naming
$cib.CultureEnglishName = "English (Thailand)"
$cib.CultureNativeName = "English (Thailand)"
$cib.IetfLanguageTag = $newCulture
# RegionInfo
$cib.RegionEnglishName = "Thailand"
$cib.RegionNativeName = "Thailand"
# ISO
$cib.ThreeLetterISOLanguageName = "eng"
$cib.ThreeLetterWindowsLanguageName = "ENG"
$cib.TwoLetterISOLanguageName = "en"
$cib.ThreeLetterISORegionName = "THA"
$cib.TwoLetterISORegionName = "TH"
$cib.ThreeLetterISORegionName = "THA"
$cib.ThreeLetterWindowsRegionName = "THA"
# Currency
$cib.ISOCurrencySymbol = "THB"
$cib.CurrencyEnglishName = "Thai Baht"
$cib.CurrencyNativeName = "Thai Baht"
$cib.NumberFormat.CurrencySymbol = "฿"
# Dates
$cib.GregorianDateTimeFormat.ShortDatePattern = "d/M/yyyy";
# Print values
Write-Verbose ($cib | Format-List | Out-String)
Write-Verbose ($cib.GregorianDateTimeFormat | Format-List | Out-String)
Write-Verbose ($cib.NumberFormat | Format-List | Out-String)
$cib.Register();
} -ComputerName $Servers -Credential $Credential
Write-Output "Registered new culture $newCulture on $servers"
}
The fix is to upgrade the OS of the machine running your system. As documented here...
en-HK is supported in "Release 8.1"
Release 8.1 correlates to "Windows 8.1 and Windows Server 2012 R2. Supported in all later versions."
So yes you will see en-HK on Windows 8.1 to see it on your server install the R2 service pack.
来源:https://stackoverflow.com/questions/28281161/installing-more-cultures-on-windows-server-2012