NeutralResourcesLanguage Usage
Asked Answered
S

3

7

The verbiage below is from a generated AssemblyInfo file. Does this mean MS is recommending I modify the .csproj file by hand? By a Setting?

If it is by a Setting then what use is the NeutralResourcesLanguage attribute? How are you supposed to access it in code.

Cheers,
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)]
Sessions answered 15/12, 2011 at 14:58 Comment(0)
S
10

This attribute (not a setting) can be defined in project properties, like so

  1. In Solution Explorer, right-click your project, and then Click Properties.
  2. From the left navigation bar select Application, and then click Assembly Information.
  3. In the Assembly Information dialog box, select the language from the Neutral Language drop-down list.
  4. Click OK.
Sessions answered 20/12, 2011 at 18:8 Comment(1)
Thanks, But VS Express doesn't add , UltimateResourceFallbackLocation.Satellite. So you must open AssemblyInfo.cs and manually add the highlighted textTaiga
A
9

In .Net core projects you can specify it in csproj:

<PropertyGroup>
  <TargetFramework>netcoreapp3.0</TargetFramework>
  <NeutralLanguage>fr</NeutralLanguage>
</PropertyGroup>

or using Visual studio:

  1. In Solution Explorer, right-click your project, and then Click Properties.
  2. From the left navigation bar select Package
  3. Select value for Assembly neutral language
Alisun answered 1/1, 2020 at 23:25 Comment(0)
H
0

Drop this into your csproj file within the project:

<ItemGroup>
    <AssemblyAttribute Include="System.Resources.NeutralResourcesLanguageAttribute">
        <_Parameter1>"en-US"</_Parameter1>
        <_Parameter1_IsLiteral>true</_Parameter1_IsLiteral>
        <_Parameter2>System.Resources.UltimateResourceFallbackLocation.Satellite</_Parameter2>
        <_Parameter2_IsLiteral>true</_Parameter2_IsLiteral>
    </AssemblyAttribute>
</ItemGroup>
Helenahelene answered 16/8, 2023 at 14:25 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Wortham

© 2022 - 2024 — McMap. All rights reserved.