turquoiseowl / i18n

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

Nuggets are not translated in Web Api #364

Closed andreiholubeu closed 5 years ago

andreiholubeu commented 6 years ago

Hi,

I try to use the nugget package for localization (using cookie) in asp.net web api but it seems that it is not applied correctly.

My header cookie:

i18n.langtag=fr

But on the exit I am getting value wrapped with [[[]]]:

[[[Value]]]

turquoiseowl commented 5 years ago

Closing this. Please re-open if still an issue.

BarbeNoire commented 5 years ago

Hi,

I try use to use i18n in a WebApi Owin project but, nuggets are not translate in the response.

Here my config:

Startup.cs :

            var config = GlobalConfiguration.Configuration;
            I18nConfig.Configure();
            app.Use(typeof(UrlLocalizationMiddleware));
            app.UseWebApi(config);

Global.asax.cs :

        protected void Application_ReleaseRequestState(object sender, EventArgs e)
        {
            var context = Request.GetOwinContext().Get<HttpContextBase>(typeof(HttpContextBase).FullName);
            LocalizedApplication.InstallResponseFilter(context);
        }

Notes:

  1. Application_ReleaseRequestState is never called
  2. I had to had Global.asax file to my project in order to make i18n work as expected in Readme.md and as i18n is tighly coupled to System.Web

Could someone, please, provide me a solution ?

Thanks

turquoiseowl commented 5 years ago

Just checking you've followed instructions here https://github.com/turquoiseowl/i18n#owin-support and in related issues? There are restrictions to the OWIN support to be aware of.