简体   繁体   English

使用C#.NET的多语言Windows应用程序

[英]Multilingual windows application using C#.NET

I am working on an application in C#, I want to make it multilingual. 我正在使用C#开发应用程序,我想使其成为多语言版本。 I have 2 options for that first, creating seperate resource file for all class files, second creating one common resource file for whole application. 为此,我有2个选项,为所有类文件创建单独的资源文件,其次为整个应用程序创建一个公共资源文件。

I am not sure which option is best, so can somebody advise me regarding this?? 我不确定哪个选项最好,所以有人可以建议我吗? If there is any other way of achieving multilingual functionality then also please let me know. 如果还有其他实现多语言功能的方式,也请告诉我。

Cheers :) 干杯:)

In my experience, it is easier to have all of your localized resources in one place. 以我的经验,将所有本地化资源集中在一个地方比较容易。 Often, an application will have strings that are used in several places. 通常,应用程序将具有在多个地方使用的字符串。 If you have all of your resources in one place, you will only have to translate the repeated string once. 如果将所有资源都放在一个位置,则只需将重复的字符串转换一次。

I prefer to use the built-in localization feature included in the IDE. 我更喜欢使用IDE中包含的内置本地化功能。 It can be finicky but it gets the job done. 这可能很挑剔,但可以完成工作。 It generates a separate DLL for each language. 它为每种语言生成一个单独的DLL。

In cases where I have non-UI strings, I have a single XML file containing all languages with language strings tied to unique identifiers. 在使用非UI字符串的情况下,我有一个XML文件,其中包含所有语言,并将语言字符串绑定到唯一标识符。

I've used "Multi-Language Add-In" from Softwarebuero Jollans ( http://jollans.com/tiki/tiki-index.php ). 我使用了Softwarebuero Jollans( http://jollans.com/tiki/tiki-index.php )的“多语言加载项”。 It's a commercial product that's quite well supported. 这是一种得到了很好支持的商业产品。 You can export strings from your application in Visual Studio to an Excel spreadsheet to be translated, and then re-import the spreadsheet to your application. 您可以将字符串从Visual Studio中的应用程序导出到要转换的Excel电子表格中,然后将电子表格重新导入到您的应用程序中。 Languages will then be automatically compiled into embedded resources. 语言将被自动编译为嵌入式资源。

I would create a single resource file in each assembly (where needed). 我将在每个程序集中创建一个资源文件 (需要时)。

You can let VS create a class for the resource file, which allows compile-time-safely accessing the resources. 您可以让VS为资源文件创建一个类,该类允许在编译时安全地访问资源。 (You get a property for each string.) I think you do this with the Build Action. (您将为每个字符串获得一个属性。)我认为您可以通过Build Action来实现。 The generated class is internal. 生成的类是内部的。 So resources are accessed only within the assembly, which makes sense. 因此,资源只能在程序集中访问,这很有意义。

Use one resource file and be sure you have all your forms and components marked as localizable. 使用一个资源文件,并确保将所有表单和组件标记为可本地化。 With this done you have the ability to use several third party tools to localize your application. 完成此操作后,您便可以使用多个第三方工具来本地化您的应用程序。

We use Visual Localize at work. 我们在工作中使用Visual Localize。 Not that you just can export your text resourcess and reimport after translation, you can also resize or rearrange dialogs to fit the new text sizes. 不仅可以导出文本资源并在翻译后重新导入,还可以调整对话框的大小或重新排列以适应新的文本大小。 Eg german is one and a half time longer than the same text in english. 例如,德语比英语的同一文本长一倍半。

We wrapped gettext and used that. 我们包装了gettext并使用了它。 The positives being that one can just add a new translation and everything works. 积极的一面是,只需添加一个新的翻译即可,一切正常。 One can change language on the fly. 可以随时更改语言。 And that it easy for translators because one can just send them a simple text file that they can edit. 对于翻译人员而言,这很容易,因为他们可以向他们发送一个可以编辑的简单文本文件。

We didn't release or put it out into a project yet, but we might do that if people find it interesting. 我们尚未发布或将其发布到项目中,但是如果人们发现它有趣,我们可能会这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#.net中的Windows Services for Console应用程序 - Windows Services for Console application in C#.net 在C#.net Windows应用程序中上传文件 - Upload Files in C#.net Windows Application 使用Windows应用程序C#.net Windows应用程序在datagridview中的静态行 - static row in datagridview using windows application C#.net windows application MFC / C#.NET混合模式本地化(多语言/多语言应用程序) - MFC / C#.NET mixed mode localization (multi language / multilingual application) 在C#.net GUI应用程序中使用控件 - Using controls in C#.net GUI Application 使用C#.Net在Windows窗体应用程序中的弹出窗口上显示后台任务的进度 - show progress of the background task on a pop-up windows in windows form application using C#.Net 在c#.net中使用Windows应用程序获取列表中的复选框列表值 - Get check box list values in List using windows application in c#.net 如何使用C#.net Windows应用程序在Outlook电子邮件正文中设置字体颜色 - How to set font color inside outlook email body using c#.net windows application 想要使用C#.net桌面应用程序在Windows 7中调用碎片整理过程 - Want to call Defragment Process in Windows 7 using C#.net Desktop Application 使用C#.Net将应用程序窗口表单链接到条形码打印机Zebra TLP2844 - Linking application windows form using C#.Net to barcode printer Zebra TLP2844
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM