Hello,
I'm currently developing an application that will have to support Globalization, meaning that it will have to support different languages.
I've been doing some research since this all new to me and I want to take the best approach, and for now all I've been doing is following some introductory tutorials for that matter.
I have found several tutorials for MVC 3, but very few for MVC 4 and I haven't really managed to find anything that could cover some of the requisites I've set for my application which involve:

  • Being able to change the current views with Resource Strings, and this means that I'm not willing to create extra views for every new language.
  • Being able to change the CultureInfo of my application through URL Routing, for example, if my website is www.example.com/en, the Culture Info associated would be English, or if it is www.example.com/es, the Culture Info would be Spanish.

I'm writing this topic not to ask how to do it, but more to ask, where to start from , and what I should be doing, in order to be able to accomplish my requisites.
I remember again that this is all new to me and I haven't got a single clue on what to do, that's why I'm asking for your help since I don't even know if this is possible to do in the current MVC 4.

Thanks in advanced for all the help and suggestions posted here.

Recommended Answers

All 5 Replies

Member Avatar for LastMitch

I'm writing this topic not to ask how to do it, but more to ask, where to start from , and what I should be doing, in order to be able to accomplish my requisites.I remember again that this is all new to me and I haven't got a single clue on what to do, that's why I'm asking for your help since I don't even know if this is possible to do in the current MVC 4.

Try this tutorial to get a feel on how MVC 4 works (it seems to me base on what you mention that you not familiar with MVC 4):

http://net.tutsplus.com/tutorials/building-an-asp-net-mvc4-application-with-ef-and-webapi/

The question you ask about Globalization and Localization, you can find some code snippet on here (I'm not sure why you mention you can't find any tutorial because the code snippet is provided in ASP.net library you can used it or modify it):

http://msdn.microsoft.com/en-us/library/c6zyy3s9%28v=vs.100%29.aspx

You can also read this good article:

http://www.mikesdotnetting.com/Article/183/Globalization-And-Localization-With-Razor-Web-Pages

This tutorial: Using Globalization and Localization in ASP.NET:

http://www.codeproject.com/Articles/334820/Using-Globalization-and-Localization-in-ASP-NET

If you are going to create something at least get some code that you can used as a reference even though it's MVC 3.

Thanks for the links, however those articles don't cover the way how URL routing works. If you notice they choose language from a checkbox and the URL stays the same.

Member Avatar for LastMitch

Thanks for the links, however those articles don't cover the way how URL routing works.

It's part of MVC framework:

http://msdn.microsoft.com/en-us/library/cc668201%28v=vs.100%29.aspx

If you notice they choose language from a checkbox and the URL stays the same.

The code for that is here:

http://msdn.microsoft.com/en-us/library/cc668201%28v=vs.100%29.aspx#setting_default_values_for_url_parameters

Another words the whole article explains routing to you how you can modify the code to fit your own project.

I mean you mention that you are developing an application that will have to support Globalization.

How long have you used ASP.net framework? I thought you were familiar with the framework? These are very basic.

Thanks for sharing those links, now I can solve the URL routing issue in MVC 4.

Thanks for sharing those links, now I can solve the URL routing issue in MVC 4.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.