COM+ 的本地化组件
我的解决方案中有两个项目:
- ClassLibrary1(类库),其中包含
- 类
Class1
,具有公共方法:公共共享函数 GetMyValue() As String 返回 My.Resources.MyResource.MyVariable End 功能 - 两个资源文件 - MyResource.resx 和 MyResource.de.resx,它们都包含一个名为 myVariable 的字符串资源,其值为 “default”(在 MyResource.resx 中)和“de”(在 MyResource.de.resx 中)。
- 类
- TempLocalization 项目(Windows 窗体),只有一个窗体和 OnLoad 事件处理程序。
代码:
Thread.CurrentThread.CurrentUICulture = New CultureInfo("de")
MessageBox.Show(Class1.GetMyValue())
当我运行该项目时,显示正确的值,即“de”。但是,当我设置 ClassLibrary1 项目的“使程序集 COM 可见”选项并将其安装到 COM+ 环境中时,这不再起作用 - MessageBox 显示值“默认”。
如何正确本地化我的 COM+ 程序集?
I have two projects in my solution:
- ClassLibrary1 (Class Library), which contains
- a class
Class1
, with a public method: Public Shared Function
GetMyValue() As String Return My.Resources.MyResource.MyVariable End
Function - Two resource files - MyResource.resx and MyResource.de.resx, both of them contain a string resource named myVariable with the value
'default' (in MyResource.resx) and 'de' (in MyResource.de.resx).
- a class
- TempLocalization project (Windows Forms), with only one form and the OnLoad event handler.
The code:
Thread.CurrentThread.CurrentUICulture = New CultureInfo("de")
MessageBox.Show(Class1.GetMyValue())
When I run the project, the correct value is shown, which is "de". But when I set the ClassLibrary1 project's 'Make assembly COM-visible' option and install it into COM+ environment, then this doesn't work anymore - the MessageBox displays the value "default".
How can I correctly localize my COM+ assembly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论