Closed rinkeb closed 7 years ago
I am considering using Westwind.Globalization for a new project with .NET Core. I am okay with running the web editor app separatley (as a MVC 5 app on full .NET Framework), but wanted to be able to read the resources from my .NET Core app.
I made an extremely quick and dirty .NET Standard 2.0 PoC where I ripped everything not related to reading resources: https://github.com/geirsagberg/Westwind.Globalization/commit/d45bf4d35998cf4e96f54af7ce188632f5f00ca6
It compiles, but I haven't tested it yet. Will update if it works.
The solution from Damienbod seems nice too. See https://damienbod.com/2016/01/29/asp-net-core-1-0-using-sql-localization/
That looks very interesting, thanks for the tip!
Damienbod however only covers the backend localization part, not a UI for editing texts, like Westwind.Globalization has.
It seems to me, in order to port this to Core, the following steps are needed:
UPDATED: See https://github.com/geirsagberg/Westwind.Globalization/tree/core
Microsoft.Extensions.Configuration
-stuffLocalizationService.ashx
with a new LocalizationMiddleware
for ASP.NET CoreIStringLocalizer
in some way, perhaps using the stuff from https://damienbod.com/2016/01/29/asp-net-core-1-0-using-sql-localization/I would also try to re-engineer the solution away from static instances, in favor of utilizing the new Dependency Injection stuff in ASP.NET Core.
I have made a fully functional port for .NET Standard 2.0, check it out here :)
Was developed fully on a Mac, so haven't tested for Windows yet; might be some directory separator weirdness.
Thanks for that! I'm on vacation for a couple of weeks so I don't have time to look at this right away, but I'll take a look then. I'm starting some localization work around that time anyway so the timing for this is perfect. Thanks again.
@geirsagberg - I took a quick look at what you've done and that looks great.
A little hard to really see all the changes. But I'll have to take a slightly different approach at least for the base package - rather than branching completely off for separate Core libraries I'm trying to keep both .NET full and Core versions going in a single package for the base component (Westwind.Globalization) with multi-targeting. The others, then can be separate implementations that follow what you have here.
I'm going to try and set up the base package this weekend and see where I end up with that.
Thanks for your work with this - much appreciated.
Gotcha, I was focused on making it work with ASP.NET Core more than keeping backwards compatibility.
With that said, I am currently removing all references to ASP.NET Core from the Westwind.Globalization.Core
project, so it will be fully .NET Standard 2.0 compatible and web agnostic. As long as you find a way to make it work with both Westwind.ApplicationConfiguration and Microsoft.Extensions.Configuration (maybe use an adapter), you should be good to go :)
Yeah that's my plan as well.
Again thanks for the great work. Just wish I had more time to look into this at the moment.
FYI, I have removed all web dependencies from Westwind.Globalization.Core
now, on my master branch: https://github.com/geirsagberg/Westwind.Globalization/tree/master
First of all thanks again for those that have asked and especially Geir who put in the effort to port to Core on his own.
I checked out the code and while it looks good, I frankly had to go through this myself to be sure I understand all the details about the fairly major changes that are required to make the port. There are a lot of little details that needed attention and I was uncomfortable taking a codebase with very large changes and just merge it in here.
In any case there's now an active ASP.NET Core branch: https://github.com/RickStrahl/Westwind.Globalization/tree/AspNetCore_Support
and this version of Westwind.Globalization is fully working both as a .NET Standard 2.0 and .NET 4.5 (Westwind.Globalization) and .NET Core 2.0 (Westwind.Globalization.AspNetCore and Sample app).
Pretty much the entire feature set was able to migrate over with the exception of Image resources due to lacking common image library.
The .NET Core branch has been merged into Master and the project is now in beta stage with just about all features ported over to .NET Core.
Any plans for making the jump to .net core ?