简体   繁体   English

C#卫星程序集? 我是否需要链接默认的文化资源

[英]C# Satellite Assemblies? Do I need to link default culture resource

We would like to employ satellite assemblies to contain various locale dependent resource files. 我们希望使用附属程序集来包含各种与语言环境有关的资源文件。

Question is ... do we need to link the default culture? 问题是……我们需要链接默认区域性吗?

We have a separate project which will contain all of our different culture resource files. 我们有一个单独的项目,其中包含我们所有不同的文化资源文件。 As is shown below, we have the project with two resource files inside of it. 如下所示,我们在项目中包含两个资源文件。

ProjRES ProjRES

  • Resource.resx Resource.resx
  • Resource.it-IT.resx Resource.it-IT.resx

I am assuming that the "Resource.resx" will act as the default culture and if the Italian culture is selected, the application will adopt the it-IT resource file. 我假设“ Resource.resx”将作为默认区域性,如果选择了意大利区域性,则应用程序将采用it-IT资源文件。

What do we need to do in order to get the rest of the application and projects to access the resource files. 为了获得其余的应用程序和项目来访问资源文件,我们需要做什么。 How do we set the namespaces for the resource files in order to be able to reference them. 我们如何为资源文件设置名称空间以便能够引用它们。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Basically, 基本上,

if the current culture that the OS is using matches a certain culture that you've shipped, it will be used, if the current culture matches none of the cultures you've shipped, it will use the neutral culture. 如果操作系统正在使用的当前区域性与您已交付的特定区域性相匹配,则将使用它;如果当前区域性与您已交付的所有区域性都不匹配,则将使用中性区域性。

In the most simplistic cases, you'll just need to include any of the localized dlls with the deployment and all will be fine.. 在最简单的情况下,您只需要在部署中包括任何本地化的dll,就可以了。

When you're using resource managers, I think you can also pass in which culture you want to use explicitly, and the runtime will search for resources that match - this is better when a user of an ASP.Net site might have a certain culture preference that is different from that of the machine that the site is running on. 当您使用资源管理器时,我认为您也可以传递要明确使用的文化,运行时将搜索匹配的资源-当ASP.Net网站的用户可能具有特定文化时,这会更好与网站运行所在计算机的首选项不同的首选项。

http://msdn.microsoft.com/en-us/magazine/cc163609.aspx seems to be a good starting point. http://msdn.microsoft.com/zh-cn/magazine/cc163609.aspx似乎是一个很好的起点。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM