mccalltd/AttributeRouting — Issue #46: Multiple Translation Providers
Author: shapper
Created: 2012-02-13 21:00:03+00:00
State: open

Hello,

I have been using the new Translation Provider and it is great. I have one suggestion:

At the moment, if I am not wrong, it is only possible to use one translation provider:

routes.MapAttributeRoutes(config =>
{
config.AddRoutesFromController();
config.AddRoutesFromController();
config.TranslationProvider = translations;
});

I think it would be useful to have many TranslationProviders. For example:

RouteTranslationProvider
AreaXYZRouteTranslationProvider
...

In this case I have the global translation provider and one specific for the routes in one area.

This helps not only on organization, and area portability, but also avoid namespaces issues.
For example, usually there are main controllers and area controllers with the same name.

And some people might want to have a AreaLocalizationProvider, ActionLocalizationProvider, ...

I would suggest something as Profiles in Automapper:

Mapper.Initialize(x => {
x.AddProfile();
x.AddProfile();
});

So it would becomes something like:

routes.MapAttributeRoutes(config =>
{
config.AddRoutesFromController();
config.AddRoutesFromController();
config.AddTranslationProvider;
config.AddTranslationProvider;
});

What do you think?

Thank You,
Miguel