turquoiseowl / i18n

Smart internationalization for ASP.NET
Other
556 stars 156 forks source link

New .NET 4.5 project supporting Owin.Host.SystemWeb #241

Closed berniezhao closed 8 years ago

berniezhao commented 8 years ago

I created a new .NET 4.5 project i18n.Owin.SystemWeb to support Owin hosted in IIS. The project is still dependent on System.Web so it is not "pure" Owin but more like an intermediate version for Katana only. "Pure" Owin support will require restructure the code base. We will probably need to separate the code to more packages (i18n.core, i18n.owin, i18n.systemweb, i18n.owin.systemweb) so I'm leaving the decision to other folks.

The existing i18n project is not changed except for incorporating fix by suddenelfilio https://github.com/suddenelfilio/i18n/commit/ca753201ad294552163f4b3320b1dba25234e4b9

If you use it in ASP.NET, all the existing configuration/setup still works. If you use it in Owin hosted in IIS, you can configure middleware by code (no web.config change in this case).

public partial class Startup
{
    public void Configuration(IAppBuilder app)
    {
        ...
        ...

        // i18n
        app.Use(typeof(UrlLocalizationMiddleware));
        app.Use(typeof(EntityLocalizationMiddleware));

    }
}
berniezhao commented 8 years ago

And sorry for having to create it in VS2013. I don't have 2012 at the moment...

turquoiseowl commented 8 years ago

Looks good, thanks.

Would you be able to write a small section in the README with respect to OWIN support in i18n as it stands after this addition?

turquoiseowl commented 8 years ago

I've added a stub OWIN section to the readme.

berniezhao commented 8 years ago

will do.

berniezhao commented 8 years ago

Pull request created.
@turquoiseowl I will create new new NuGet package "I18N.Owin.SystemWeb" if that's ok for you. The new package will have dependency on "I18N" NuGet package and .NET 4.5. Project will link back to your GitHub page.

turquoiseowl commented 8 years ago

I've merged the pull request.

WRT the NuGet package, I would rather be careful about being associated with binaries compiled by others. Would you mind removing myself and Daniel from the metadata of your package. Alternatively delete it and I'll re-create one from this end.

Thanks.

berniezhao commented 8 years ago

Deleted. You can create a new one.

turquoiseowl commented 8 years ago

Hmmm, NuGet doesn't seem to allow package re-creation:

C:\DevRoot\DevGit\i18n\src\i18n.Owin.SystemWeb>nuget push i18n.Owin.SystemWeb.2.1.6.0.nupkg
Pushing i18n.Owin.SystemWeb 2.1.6.0 to the NuGet gallery (https://www.nuget.org)...
Failed to process request. 'The specified API key is invalid or does not have permission to access the specified package.'.
The remote server returned an error: (403) Forbidden..

Any ideas for a new name for i18n.Owin.SystemWeb?

berniezhao commented 8 years ago

Hmmm... I18N.WebApi? I18N.Owin.Katana?

berniezhao commented 8 years ago

@turquoiseowl I added you to the package owner. You can confirm the ownership and re-publish your compiled package. You can also remove me from owners.

turquoiseowl commented 8 years ago

I've settled with i18n.Adapter.OwinSystemWeb, reason being that arguably i18n.Owin.... should be reserved for a pure OWIN version of i18n - see #243. Let me know if you have problems. Thanks.