wpf 如何在visual studio express 2012中添加resx文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24217485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 11:55:15  来源:igfitidea点击:

How to add resx file in visual studio express 2012?

c#wpfvisual-studio-2012

提问by dancer_69

screenchot:AddNewItemI'm trying to localize my WPF project, but it seems that there is no option to add a .resxfile?

屏幕截图:添加新项目我正在尝试本地化我的 WPF 项目,但似乎没有添加.resx文件的选项?

There is a resource file in project's directory which is for all resources(strings, images, audio files etc). But from my understanding, you can add strings for only one language.

项目目录中有一个资源文件,用于所有资源(字符串、图像、音频文件等)。但根据我的理解,您只能为一种语言添加字符串。

采纳答案by Typist

Add separate resource file (.resx) for each language and use them by changing the thread UI Culture - http://www.thebestcsharpprogrammerintheworld.com/blogs/localizing-a-wpf-program-using-csharp.aspx.

为每种语言添加单独的资源文件 (.resx),并通过更改线程 UI Culture - http://www.thebestcsharpprogrammerintheworld.com/blogs/localizing-a-wpf-program-using-csharp.aspx 来使用它们。

See following screen-shot. Right-click on project -> Add -> New Item. Name your file according the culture you want. I named it for Dutch language.

请参阅以下屏幕截图。右键单击项目 -> 添加 -> 新项目。根据您想要的文化命名您的文件。我将它命名为荷兰语。

enter image description here

在此处输入图片说明

回答by Typist

You can do a similar thing if you go to your Project's Properties, and then go to the "Resources" tab there.

如果您转到项目的属性,然后转到那里的“资源”选项卡,您可以执行类似的操作。

Multiple ways to get to Project Properties:

获取项目属性的多种方式:

  1. MENU: Project > Properties

  2. Solution Explorer: Expand the project so the "Properties" node is visible. Double-click on it.

  1. 菜单:项目 > 属性

  2. 解决方案资源管理器:展开项目以便“属性”节点可见。双击它。

Another way (if you really want to add a file) is to right-click on your project (Solution Explorer) and click Add New Item. Here, on the left-hand side select "General" and on the right-hand side select "Resources File".

另一种方法(如果您真的想添加文件)是右键单击您的项目(解决方案资源管理器),然后单击添加新项目。在这里,在左侧选择“常规”,在右侧选择“资源文件”。