turquoiseowl / i18n

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

Is ActionLink extended? #272

Open rickardliljeberg opened 8 years ago

rickardliljeberg commented 8 years ago

I have noticed that if I use Html.ActionLink (in razor views) I get urls including the language tag like "/en/controller/action"

However if I use Url.Action then I only get "/controller/action" and no language tag first.

Is this because i18n overrides ActionLink? If so, could we do the same for Url.Action?

turquoiseowl commented 8 years ago

i18n has been uncoupled from MVC entirely which means that Html.ActionLink won't have been extended.

The reason URL strings generated by Html.ActionLink are being localized is because they are located in well-known locations in the HTML output (e.g. href attributes) which enables i18n to locate them and localize them.

The same is not necessarily true of Url.Action unless you happen to put the generated string in something like an href attribute.

There would be scope for an i18n.MVC helper lib that extends these MVC classes e.g. Url.ActionLocalized etc.. (if you're willing :) ).

rickardliljeberg commented 8 years ago

This explains it perfectly.

There are a few things I would like to contribute to this project, I just never ever have time :-(