NeutralResourcesLanguage用法

Ber*_*ryl 5 .net silverlight wpf resources visual-studio

下面的措辞来自生成的AssemblyInfo文件.这是否意味着MS建议我手动修改.csproj文件?通过设置?

如果是设置,那么NeutralResourcesLanguage属性有什么用?你应该如何在代码中访问它.

干杯,
Berryl

//In order to begin building localizable applications, set 
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>.  For example, if you are using US english
//in your source files, set the <UICulture> to en-US.  Then uncomment
//the NeutralResourceLanguage attribute below.  Update the "en-US" in
//the line below to match the UICulture setting in the project file.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
Run Code Online (Sandbox Code Playgroud)

Ber*_*ryl 9

可以在项目属性中定义此属性(不是设置),如此

  1. 在解决方案资源管理器中,右键单击项目,然后单击"属性".
  2. 从左侧导航栏中选择"应用程序",然后单击"程序集信息".
  3. 在"装配信息"对话框中,从"中性语言"下拉列表中选择语言.
  4. 单击确定.


Alb*_*rtK 6

.Net 核心项目中,您可以在csproj以下位置指定它:

<PropertyGroup>
  <TargetFramework>netcoreapp3.0</TargetFramework>
  <NeutralLanguage>fr</NeutralLanguage>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

或使用Visual studio

  1. 在解决方案资源管理器中,右键单击您的项目,然后单击Properties
  2. 从左侧导航栏中选择 Package
  3. 选择值 Assembly neutral language