How to localize the ActionName in MVC Widgets?
Hi guys,
I searched a lot to find an answer to the question in the subject.
Consider to have a custom MVC Wdget and the controller has an action SetPage(int pagenumber); so the resulting url to invoke the action should be: website-page/SetPage/pagenumber.
How to localize "SetPage"? How to make an action name localizable?
Regards,
Stefano.
codicezerouno
Hello Stefano,
Thank you for using Sitefinity.
As a limitation of MVC the only way possible would be to add an entry to the routes table for every language you want to support? All of the localized routes could redirect to the route in the language of your choice. Check out these related questions:
Multi-lingual websites with ASP.NET MVC
How should I implement localization with ASP.NET MVC routes?
Let me know if you have any questions.
Regards,Hi Patrick,
is there a better way to manage it for example by writing a custom route handler?
Regards,
Stefano.
Hi Stefano,
Possible although untested since we already use a custom route handler in Sitefinity as it is.
You can check out this thread. They seem to have a decent enough idea that may work.
http://stackoverflow.com/questions/3935768/is-it-possible-to-localize-a-url-routing-in-asp-net-mvc