I have a question for you. Now, I am going to build a website, it supports multi language. I'm using ASP.Net MVC3 (Razor). I have found many sample source code, but I haven't done yet.
For example: http://geekswithblogs.net/shaunxu/archive/2010/05/06/localization-in-asp.net-mvc-ndash-3-days-investigation-1-day.aspx
I've done along this tutorial, but I didn't call the following code in Views or Controllers.
Resources.Global.HomeIndex_Title
Have you got any better solutions? Please help me!
I've tried to do along your tutorial, but it is too long, and it makes so many instances of one view. I want a simple solution, maybe pass culture into url address, eg: http://acb.com/en-Us/Home/Index
NhanDT
Member
27 Points
18 Posts
Multi language in MVC3 Razor
Apr 11, 2012 08:46 AM|LINK
Hi everybody,
I have a question for you. Now, I am going to build a website, it supports multi language. I'm using ASP.Net MVC3 (Razor). I have found many sample source code, but I haven't done yet.
For example: http://geekswithblogs.net/shaunxu/archive/2010/05/06/localization-in-asp.net-mvc-ndash-3-days-investigation-1-day.aspx
I've done along this tutorial, but I didn't call the following code in Views or Controllers.
Have you got any better solutions? Please help me!
Thank you!
rado_
Member
148 Points
34 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 08:52 AM|LINK
Hi,
You may find this guide useful : http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html
Hope it helps!
2*MCTS,MCPD
ASP.NET MVC Controls
Follow @RadoslavMinchev
amitpatel.it
Star
7976 Points
1865 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 08:52 AM|LINK
Implement resource file and then implemnent it in model to bind related controls cpation or in razor page.
[Display(ResourceType = typeof(TR.Common.TR_Resources), Name = "Description")] [DataType(DataType.MultilineText)] [StringLength(500)] public string Description { get; set; }or Use below code in razor page.
<div class="editor-label"> @TR_Resources.Users<span class="reqtext">*</span> </div>MCPD Enterprise and Web Application
MCTS Web, Window and Enterprise Application
NhanDT
Member
27 Points
18 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 08:58 AM|LINK
Thank for your answers, would you give me a small example?
NhanDT
Member
27 Points
18 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 09:08 AM|LINK
I have done following this tutorial, but when I call ViewRes.SharedStrings.Title. It shows the error, because it doesn't know what is ViewRes.
rado_
Member
148 Points
34 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 10:08 AM|LINK
I will check that out and ping you back
2*MCTS,MCPD
ASP.NET MVC Controls
Follow @RadoslavMinchev
rado_
Member
148 Points
34 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 10:57 AM|LINK
I couldn't find the code from this walkthrough, however the one that is for the newer MVC 3 version and works (I''ve tested in my machine) is from this blog : http://afana.me/post/aspnet-mvc-internationalization.aspx
There's code attached in the begining of the sample.
2*MCTS,MCPD
ASP.NET MVC Controls
Follow @RadoslavMinchev
NhanDT
Member
27 Points
18 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 12:55 PM|LINK
Thank rado_, I will try it now and report later.
NhanDT
Member
27 Points
18 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 02:21 PM|LINK
Hi rado_!
I've tried to do along your tutorial, but it is too long, and it makes so many instances of one view. I want a simple solution, maybe pass culture into url address, eg: http://acb.com/en-Us/Home/Index
rado_
Member
148 Points
34 Posts
Re: Multi language in MVC3 Razor
Apr 11, 2012 03:20 PM|LINK
hi NhanDT,
I would say that this is the prefered way doing internationalization even Scott Hanselman presents the similr apprach :
http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx
2*MCTS,MCPD
ASP.NET MVC Controls
Follow @RadoslavMinchev