turquoiseowl / i18n

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

api/ redirect #271

Closed dbvcode closed 8 years ago

dbvcode commented 8 years ago

Hi, I have a WebAPI in my MVC project configured like this in the WebApiConfig.cs

        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }

If I turn off i18n the api works like a charm. When i18n is on (references loaded) whenever I go to /api/{controller}/{action}/{id} I get redirected to /{controller}/{action}/{id}

How can I override this redirect? Or even better how can I use i18n with the WebApi?

Thanks.

turquoiseowl commented 8 years ago

Please see #240

turquoiseowl commented 8 years ago

The setting i18n.UrlLocalizer.QuickUrlExclusionFilter may be of help.

https://github.com/turquoiseowl/i18n#exclude-urls-from-being-localized

dbvcode commented 8 years ago

Thanks, I took /api out from being localized.