[英]External Translations in .NET
Good morning, 早上好,
I am interested in developing an application which supports external GUI translation files to be added as desired by the users. 我对开发一种应用程序感兴趣,该应用程序支持用户根据需要添加外部GUI转换文件。 I thought about using the localization methods built into .NET, but I think this way I cannot distribute isolated files with translations (can I?) after the application is built.
我考虑过使用.NET内置的本地化方法,但是我认为通过这种方式,在构建应用程序后,我无法分发带有翻译的隔离文件(可以吗?)。
What is the better way to achieve localization using external files in C#? 使用C#中的外部文件实现本地化的更好方法是什么?
Thank you very much. 非常感谢你。
I've seen a lot of people implementing their own localization system for .net, but personally, I would stay with the built in structure. 我见过很多人为.net实现自己的本地化系统,但就我个人而言,我会坚持使用内置结构。
Now, you can just add additional .resx files and recompile the app afterwards. 现在,您只需添加其他.resx文件,然后再重新编译该应用程序即可。 But I guess this is not what you want?
但是我想这不是你想要的吗?
Or you can implement your own Resource Provider and for example get all localization strings from a DB. 或者,您可以实现自己的资源提供程序,例如从数据库获取所有本地化字符串。
Example: 例:
http://msdn.microsoft.com/en-us/library/aa905797.aspx#exaspnet20rpm_topic4 http://msdn.microsoft.com/zh-CN/library/aa905797.aspx#exaspnet20rpm_topic4
You can use .NET localizations without any issues. 您可以使用.NET本地化而没有任何问题。
After you sucessfully localized yopur appliation files, in your application folder will contain subfolders for you localized versions of assembly resources. 成功地对yopur应用程序文件进行本地化之后,您的应用程序文件夹中将包含子文件夹,这些子文件夹用于您对程序集资源进行本地化的版本。 So after adding new language into localizations, you can distrubute these new DLLs to your castomers from folder for your newly added localizations.
因此,在将新语言添加到本地化之后,您可以将这些新的DLL从文件夹中分解为您的Castomer,以用于新添加的本地化。
Cheers ;) 干杯;)
If you don't want to recompile the files later you can use something like the folowing. 如果您不希望以后重新编译文件,则可以使用以下方法。
Example xml: 范例XML:
<doc>
<loc name="English">
<form name = "main">
<okButton>OK</okButton>
....
</form>
<form name = "about">
<lblAuthorName>Author's name: </lblAuthorName>
....
</form>
</loc>
<loc name="Ukrainian">
<form name = "main">
<okButton>Добре</okButton>
....
</form>
</loc>
</doc>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.