英国非美国文化的问题 [英] Issue with English non-US Culture

查看:106
本文介绍了英国非美国文化的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用Set-Culture(Powershell作为管理员)将当前区域性"设置为"en-DE",这是英语(德国).但是,当我运行不同的PS命令以查看当前区域性"时,我仍然会得到en-US.我也检查了我的地区(格式)和位置.

I am able to use Set-Culture (Powershell as Admin) to set the Current Culture to "en-DE" which is English (Germany). However, when I run the different PS commands to view the Current Culture, I am still getting en-US. I checked my Region (Format) and Location as well.

我还必须将系统区域设置更改为德国(德国)吗?

Do I have to change the system locale as well to Germany (German) ?

这在应用程序中引起错误,因为datetime格式从en-DE到en-US是不同的,并且导致日期被错误地读取.

This is causing an error in an application, because the datetime format is different from en-DE to en-US and causing the date to be read incorrectly.

当我Set-Culturede-DE时,所有内容似乎都处于工作状态.

When I Set-Culture to de-DE, everything appears to be in working order.

我确保以管理员身份运行Powershell控制台,Set-Culture,关闭控制台.打开Powershell并运行Get-Culture[CultureInfo]::CurrentCulture[CultureInfo]::CurrentUICulture以及更多其他内容,以检查并仍然得到en-US

I make sure to run Powershell Console as Administrator, Set-Culture, close console. Open Powershell and run Get-Culture, [CultureInfo]::CurrentCulture, [CultureInfo]::CurrentUICulture and a few more to check and and still getting en-US

推荐答案

注意:使用en-DE 作为区域性标识符-即,混合语言 en (英语)具有通常不相关的地区/国家 DE(德国)-需要 Windows 10发行版为1607或更高版本的 Windows Server 2016 strong>,根据Microsoft .

Note: Use of en-DE as a culture identifier - i.e., mixing language en (English) with normally unrelated region/country DE (Germany) - requires Windows 10 with release channel 1607 or later or Windows Server 2016, according to Microsoft.

但是,在Windows 10 Pro(64位;版本1709,操作系统内部版本:16299.371)上发现,存在一个错误,该错误阻止了这种混合文化的使用.

However, there's a bug that prevents use of such mixed cultures, observed on Windows 10 Pro (64-bit; Version 1709, OS Build: 16299.371)

虽然您可以使用Set-Culture成功设置这种混合文化的值,但随后的会话无法识别它并退回到en-US (如$PSCultureGet-Culture[cultureinfo]::currentCulture)

While you can successfully set such mixed-culture values with Set-Culture, subsequent sessions do not recognize it and fall back to en-US (as reflected in $PSCulture, Get-Culture and [cultureinfo]::currentCulture)

  • This problem has been reported on UserVoice.
  • Note that PowerShell Core is not affected (but it doesn't support Set-Culture).

此答案的其余部分讨论了与漏洞无关的一般设置当前用户的文化.

The rest of this answer discusses persistently setting the current user's culture in general, irrespective of the bug.

Set-Culture -通过注册表-设置未来 PowerShell会话的区域性(仅),而不是当前会话.

Set-Culture - via the registry - sets the culture for future PowerShell sessions (only), not (also) for the current session.

Get-Culture 仅在会话启动时报告当前会话的文化 .也就是说,如果您在会话期间 更改文化(请参见下文),则会在Get-Culture中反映出 not .

Get-Culture, by contrast, only ever reports the current session's culture at session-startup time. That is, if you change the culture during a session (see below), it will not be reflected in Get-Culture.

为了也将新设置的区域性应用于当前会话,除了 Set-Culture调用,还运行以下:

In order to also apply the newly set culture to the current session, run the following in addition to the Set-Culture call:

[cultureinfo]::CurrentCulture = 'de-DE'

重新交互 (命令行)使用:

Caveat re interactive (command-line) use:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆