views:

544

answers:

2

I'm trying to plan for future (months away) localization of a new ASP.NET MVC site.

Trying to decide what makes most sense to do, as far as constructing the URLs and routing.

For instance should I start off immediately with this :

 http://www.example.com/en/Products/1001
 http://www.example.com/es/Products/1001

or just

 http://www.example.com/Products/1001

and then add other languages later

 http://www.example.com/en/Products/1001

Thats my basic main issue right now, trying to get the routing correct. I want my URLs to be indexable by a search engine correctly. I'm not even sure if I want language in the URL but I dont think there is a good alternative that wouldn't confuse a search engine.

It leads to all kinds of other questions like 'shouldnt I localize the word products' but for right now I just want to get the routing in place before I launch the english site.

+3  A: 

I asked a similar question (haven't had time to implement the answer yet), undecided about whether to include the country / locale as part of the URL or not.

http://stackoverflow.com/questions/291405/multi-lingual-websites-with-asp-net-mvc

Nick
+1  A: 

I have exactly the same URL_mapping like you. My route also uses a constraint. Works for me.

   routes.MapRoute(
            // Route name
            "LocalizedController", 
            // URL with parameters                                             
            "{language}/{controller}.mvc/{action}",
            // Parameter defaults
            new {
                controller = "Home", action = "Index", 
                language = "de"
            },
              //Parameter constraints
            new { language = @"de|en" }
Malcolm Frexner
so you chose to include the language even for english. just out of convenience?
Simon_Weaver
My default is german language. If you see the first page you dont have the language in the URL. But implicitly you get the german language. As soon as you use an action link or post to an action,you get the language in the URL.
Malcolm Frexner