多语言窗口窗体
我正在开发支持阿拉伯语和英语两种语言的Windows应用程序。我想在运行时更改表单的 UI(标签)。用户最初选择的任何语言表单都应以该语言显示。为此,我设置了以下键
如果用户选择英语
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-GB");"
如果用户选择阿拉伯语
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-Ar");
当我在 Visual Studio 中运行应用程序时,这工作正常。所有形式均根据当前选择的 UI 文化而定。
但是在计算机上安装此应用程序的 MSI 后,根据 CurrentUICulture 资源文件,它没有显示表单的标签值。即使选择的语言是阿拉伯语,它也始终仅显示英语标签。
I am developing windows application which supports two language Arabic and English. I want to change the UI (Labels) of the forms at run time. Which ever language selected by user initially forms should be displayed in that language. For this I have set following key
If user selects English
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-GB");"
If user selects Arabic
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-Ar");
This works fine when I run the application in visual studio. All the forms comes according to currently selected UI culture.
But after installing the MSI of this application on machine it is not showing the form's label values according to CurrentUICulture Resource file. It is always showing label's in English only even though selected language is Arabic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过执行以下步骤找到了该查询的解决方案。
- 实际上,在创建应用程序的安装程序时,它会映射资源 dll 文件夹,因此仅在部署项目中添加“project.resources.dll”是不够的。
- 在Application文件夹下添加一个文件夹(与bin->dubug下包含resource.dll的文件夹名称相同),然后在其下添加“project.resources.dll”。
- 它将解决问题 -> 如果所选语言是阿拉伯语,所有标签都将以阿拉伯语显示
I found the solution of this query by doing following steps.
- Actually while creating the installer of the application it maps the resource dll folder so only addition of the "project.resources.dll" in the deployment project is not enough.
- Add a folder (named same as a folder name which contains resource.dll under bin->dubug) under the Application folder then add the "project.resources.dll" under it.
- it will solves the issue->all the labels will come in arabic if the selected language is arabic