This is a migrated thread and some comments may be shown as answers.

[Solved] Multilingual support

3 Answers 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
yuchuan1
Top achievements
Rank 1
yuchuan1 asked on 13 Nov 2009, 09:29 AM
Hi!

I want to know if it is possible to use the resource file with telerik ASP.net MVC controls.
How to do it?

For example, if you have the code below, how to use the strings in the resource file?

<%
                    
    Html.Telerik().Menu()
        .Name("Menu")
        .Items(items =>
        {
            items.Add()
                   .Text("Home")
        }).Render();

%>



Thanks
 

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 13 Nov 2009, 11:02 AM
Hello yuchuan1,

You can use the approach described in this blog post:

Html.Telerik().Menu()
        .Name("Menu")
        .Items(items =>
        {
            items.Add()
                   .Text(Html.Resource("Home"))
        }).

The Resource extension method is implemented in the blog post.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
yuchuan1
Top achievements
Rank 1
answered on 16 Nov 2009, 02:53 AM
Dear Korchev ,

Thanks for the quick reply. My menu is inside the master page and my resource files are also under the "shared" folder where the Site.Master is located.

The blog's solution does not seem to work with master pages even after I modified the GetVirtualPath funtion to
 return ((WebFormView)htmlhelper.ViewContext.View).ViewPath;


Thanks
Eddie
0
Georgi Krustev
Telerik team
answered on 17 Nov 2009, 02:57 PM
Hello Eddie,

After further investigation I find out that the GetVirtualPath could not find master page path. I suppose that if you are using only one master page, you can hard-code it in the web config or you just can add it to the
ViewData, when return the view by Action method.

The only thing that I could not figure out is how to understand whether the component is in master page and when it is in WebFormView.  I suppose you can add additionala parameter to the extension method, which will show whether the component is placed into master page.

Note that this issue is not related to Telerik Extentions for ASP.NET MVC, rather then the ASP.NET MVC itself. Nevertheless, we will continue investigate the problem and if we find proper solution, it will be announced with blog post for instance.

Greetings,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
yuchuan1
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
yuchuan1
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or