部分 MonthCalendar 本地化失败(“Today”标签未翻译)
我正准备开始为此撕掉我仅剩的一点头发。
我正在 Windows 7 下开发 winforms 应用程序(.NET 3.5)。在此应用程序中是一个自定义日期选择器控件,它使用 MonthCalendar 进行实际日期选择。除了底部显示的“今天”日期之外,它工作正常并且看起来很棒。它旁边有“今天”标签。如果您的听众是以英语为母语,那么这很好。我的是丹麦的。
当区域性设置为丹麦语时,“今天”标签保持不变,而周和月名称以及日期格式遵循相关的 Windows 设置。这是一个小问题,但仍然是一个烦人的问题。
还有其他人看过这个吗?有谁知道我做错了什么?如果失败,有人知道解决方法吗?
I'm about ready to start tearing out what little is left of my hair over this.
I am working on a winforms application (.NET 3.5) under windows 7. In this application is a custom datepicker control which uses MonthCalendar for the actual date picking. It is working and looking great with the exception of the 'Today' date shown at the bottom. It has the label 'Today' next to it. This is fine if your audience is native english speakers. Mine is danish.
When the culture is set to danish, the 'Today' label remains unchanged while week and month names and date format obey the relevant windows settings. It is a minor niggle, but still an annoying one.
Has anyone else seen this? Does anyone know what I am doing wrong? Failing that, does anyone know of a workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的丹麦客户将运行丹麦版本的 Windows。其中“今天”使用丹麦语文本。更改计算机上的区域性不会改变本机 Windows 资源的语言,例如 MonthCalendar 使用的语言。
所以这不是一个真正的问题。如果您必须使其看起来真实(例如屏幕截图),请购买 Windows 旗舰版的许可证。它允许安装修改这些本机资源的语言包。或者使用 MSDN 订阅来访问丹麦语 Windows 版本。
Your Danish customers will run the Danish version of Windows. Which uses Danish text for "Today". Changing the culture on your machine does not otherwise change the language of native Windows resources, like the ones used by MonthCalendar.
So this is not a real problem. If you have to make it look genuine, for screen shots for example, then purchase a license for the Ultimate edition of Windows. Which allows installing language packs that modify those native resources. Or use an MSDN subscription to get access to the Danish Windows version.
“今天”标签反映了控制面板中操作系统的语言(区域和语言),请参见下图。
您几乎完蛋了,因为它已融入 Windows 窗体库中,并且您无法覆盖/隐藏/设置私有字段来解决此问题。这在 .NET 4.0 中也是一样的。
解决方法是隐藏 MonthCalendar 上的 Today 标签,并创建一个包含 MonthCalendar 的 UserControl,该控件模仿 Today 按钮,但以正确的语言显示文本。
The 'Today' label reflects the language of the operating system in the Control Panel (Region and Language), see Image below.
You are pretty much screwed, since this is baked into the Windows Forms library, and you cannot override/hide/set private field to fix this problem. This is the same in .NET 4.0.
A workaround is to hide the Today label on the MonthCalendar and create a UserControl with a MonthCalendar in it that mimicks the Today button but displays the text in the correct language.