Localized routing RRS feed

  • Question

  • User806403707 posted

    Is it possible that there would be different routes for different languages for exampl for english users there would be www.example.com/product/view/sunflower, but for spanish there would be www.example.com/produto/ver/girasol and for french www.example.com/produit/regarder/tournesol. (I'm not sure about spanish/french words, but you'll get the idea)

    Only thing I can come up with is to register every possible option at Application_Start, but there would be problems if for example for language x there is word that means something different on language y. Also if possible users shouldn't be able to use keywords over their language boundaries.

    Sunday, April 26, 2009 9:40 AM

All replies

  • User-1659704165 posted


    As far Finding user What Lang He/she is using is throug internet explore ....

     U can Look into Below link



    Check above link for localication

    Hope It helps

    Monday, April 27, 2009 12:56 AM
  • User806403707 posted

    Ajax is client-side technology, routing is server-side.

    For server-side, I know the language from Request.UserLanguages, with fallback to english.

    But how to apply that to routes?

    Also: Why was this thread marked as answered, since it's not?

    Wednesday, April 29, 2009 4:28 AM
  • User-1659704165 posted


    That Request also Is Client Pased...

    int count;
                String[] userLang = Request.UserLanguages;

                for (count = 0; count < userLang.Length; count++)
                    Response.Write("User Language " + count + ": " + userLang[count] + "<br>");



    know IE-->Tools -->Internet Option -->General --> lang --> Know u can add Languaes and U remove lang..

    So localization Depends On Client(on user mach)...


    and aslo Kindly check the video...

    Wednesday, April 29, 2009 5:06 AM
  • User806403707 posted

    Watched video... Not a word on routing... [*-)]

    Sunday, May 3, 2009 2:22 AM
  • User-1659704165 posted


    when u Recevive on Load of page :-

    if(userLang[count] = "us-en") then




    end if 


    in above video It shows Changing Lang without Redirect .. using Resource File


    Monday, May 4, 2009 12:58 AM
  • User806403707 posted

    Routing is a new element in ASP.NET 3.5 SP1. It has nothing to do with either ajax, or redirecting.
    Please see: http://msdn.microsoft.com/en-us/library/cc668201.aspx

    What I currently have is:

    protected override void Application_Start(object sender, EventArgs e)
    public static void RegisterRoutes(RouteCollection routes)
        routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler()));
        routes.Add(new Route("Products/{name}", new CustomRouteHandler("~/ProductView.aspx")));
        routes.Add(new Route("Customers/{name}", new CustomRouteHandler("~/CustomerView.aspx")));
    Original question was, that how can I get those "Products", and "Customers" localized, so french/german/spanish/dutch etc. users wouldn't need to know english words, but they could use their native language.
    I can't use if-sentences at RegisterRoutes-method, since then only routes with language of first user would been registered.
    Monday, May 4, 2009 9:17 AM
  • User-1659704165 posted


    Thanks For Sharing ..... the new way to complete the Localization task...

    Tuesday, May 5, 2009 12:00 AM