多语言窗口窗体

发布于 2024-12-16 16:38:32 字数 508 浏览 1 评论 0原文

我正在开发支持阿拉伯语和英语两种语言的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

唠甜嗑 2024-12-23 16:38:32

我通过执行以下步骤找到了该查询的解决方案。
- 实际上,在创建应用程序的安装程序时,它会映射资源 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文