ASP.NET Core (.NET Framework) and Localization #5219
Comments
@ryanbrandenburg, is this the same issue as the one reported here - aspnet/Localization#277 (comment)? |
No, I believe not. |
I agree with @Tolitech that this is not a duplicate of aspnet/Localization#277. It does sound very similar to dotnet/aspnetcore#1707 and dotnet/cli#4153. @Tolitech is the class library you have csproj/xproj or project.json? I would guess from context that it's csproj and therefor likely a dup of dotnet/aspnetcore#1707, do you agree @Tolitech? |
Hi, @ryanbrandenburg . I analyzed some problems here reported on Localization and most problems have the same solution as dotnet/cli#4153. The resource files are not copied to the appropriate folders BIN on ASP.NET Core. I tested several cases here and the manual copy of dlls is now working properly. Thanks. |
A note another problem: when we keep the name of the asp.net core folder different from .xproj project name is a problem that the internal resources (created within the core asp.net project) crash. Example: |
@Tolitech it sounds like this is a dup then, so I'll close it out. As for your other problem that sounds like a separate (although tangentially related) issue, so please file a new issue for it against aspnet/Localization with more details about your folder structure, what exceptions/errors you get when experiencing the problem, etc. |
Hello...
This is a bug?
Thank you.
Why the libraries that I'm using in my ASP.NET Core project (.NET Framework) do not return messages translated as the selected culture?
For example:
ResourceManager rm = new ResourceManager(typeof(ClassLibrary1.Test));
string test1 = rm.GetString("Hello", new System.Globalization.CultureInfo("en-US"));
string test2 = rm.GetString("Hello", new System.Globalization.CultureInfo("pt-BR"));
This code is in a library part that has business rules and returns a message.
But when it is referenced in an ASP.NET MVC project it returns the message as the current culture (pt-br, en-us).
But if this library is referenced in a ASP.NET Core project (.NET Framework), nothing makes it return in the current culture.
ASP.NET
ResourceManager rm = new ResourceManager(typeof (ClassLibrary1.Test));
string test1 = rm.GetString("Hello", new System.Globalization.CultureInfo("en-US"));
string test2 = rm.GetString("Hello", new System.Globalization.CultureInfo("pt-BR"));
test1 = Message en-US
test2 = Message pt-BR
ASP.NET Core
ResourceManager rm = new ResourceManager(typeof(ClassLibrary1.Test));
string test1 = rm.GetString("Hello", new System.Globalization.CultureInfo("en-US"));
string test2 = rm.GetString("Hello", new System.Globalization.CultureInfo("pt-BR"));
test1 = Message pt-BR
test2 = Message pt-BR
Detail that everything is configured correctly on ASP.NET Core because:
IStringLocalizer<HomeController>
@inject IViewLocalizer localizer
It works perfectly.
The problem is in the Resources of the referenced libraries.
Can someone help me?
The text was updated successfully, but these errors were encountered: