Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources for custom cultures are not present in \bin #387

Closed
TheRealPiotrP opened this issue Nov 12, 2016 · 2 comments
Closed

Resources for custom cultures are not present in \bin #387

TheRealPiotrP opened this issue Nov 12, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@TheRealPiotrP
Copy link
Contributor

TheRealPiotrP commented Nov 12, 2016

Moving from https://github.com/dotnet/cli/issues/4050 on behalf of @ryanbrandenburg.


Steps to reproduce

  1. Register a custom culture using something like sysglobl.dll and:
var car1 = new CultureAndRegionInfoBuilder("ru-US", CultureAndRegionModifiers.None);
car1.LoadDataFromCultureInfo(CultureInfo.CreateSpecificCulture("ru-RU"));
car1.LoadDataFromRegionInfo(new RegionInfo("en-US"));

car1.CultureEnglishName = "Russion (United States)";
car1.CultureNativeName = "русский (США)";
car1.CurrencyNativeName = "Доллар (США)";
car1.RegionNativeName = "США";

// Register the culture.
try
{
    car1.Register();
}
catch (InvalidOperationException)
{
    // Swallow the exception: the culture already is registered.
}
  1. Create a new ASP.NET Core Web Application (.NET Core)
  2. Create two resources, one named Resource.en-US.resx and one named Resource.ru-US.resx
  3. Build the project.
  4. Open bin/Debug/net451
  5. Observe that a en-US folder is present and has a dll and that ru-US is missing

Expected behavior

Any culture which will work with new CultureInfo("culture-NAME") (which custom cultures do once registered as above) should create a folder and dll which can be used in localization.

Actual behavior

Satellite assemblies are only created for original cultures, not for custom cultures.

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529

Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64

@srivatsn srivatsn added the Bug label Nov 21, 2016
@srivatsn srivatsn added this to the 1.0 RC3 milestone Nov 21, 2016
@nguerrera
Copy link
Contributor

This will work fine if you build using desktop MSBuild / Visual Studio, but .NET Core MSBuild has this.

This can be worked around with a custom target that lets any culture through:

  <Target Name="AssignCustomCultures" AfterTargets="SplitResourcesByCulture">
    <ItemGroup>
      <EmbeddedResource Condition="$([System.IO.Path]::HasExtension(%(Filename)))">
        <Culture>$([System.IO.Path]::GetExtension(%(Filename)).TrimStart('.'))</Culture>
        <WithCulture>true</WithCulture>
      </EmbeddedResource>
    </ItemGroup>
  </Target>

This approach has the advantage that it is not dependent on what is registered on the build machine.

I'll move this over to the msbuild repo to discuss what a built-in solution might look like. The root cause is there, not in the SDK.

@nguerrera
Copy link
Contributor

Moved to dotnet/msbuild#1454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants