Member 12859772 Ответов: 0

URL-адрес изменения локализации файла ресурсов Mvc


 Posted 4 days ago
I have to do for static areas with Resource File.

For example Its changing menu name but I wanna change url name. How can I do.

<a href="@Url.Action(@dil.Resource.Home, "Index","Home")">@dil.Resource.Home</a>

I want to do.

When I click english change url for example www.sitename.com/en/aboutus when I click turkish change urlwww.sitename.com/tr/hakkimizda


I want to do exactly like below link. But How can I do simple way ? Is this possible ?

https://blog.learningtree.com/localizing-asp-net-mvc-routesurls/


Что я уже пробовал:

routes.MapRoute(
  name: "Contact",
  url: "{language}/contactus",
defaults: new { language = lang, controller = "Contact", action = "Contact" });
 
 
 
      routes.MapRoute(
          name: "Default",
          url: "{language}/{controller}/{action}/{id}",
          defaults: new { controller = "Home", action = "Index", language = lang, id = UrlParameter.Optional },
          namespaces: new string[] { ".Controllers" }
 
      );

Member 12859772

Кто-нибудь может мне помочь ?

0 Ответов