7

I am looking at globalizing an application that I have developed in asp.net mvc.

I am currently using resource files to store messages that I present to the user (i.e., when I save something to the database, and the user is shown the message "The whatever was correctly saved", that text is stored in a resource file so that I can easily localize the message for another language.

The question I have is how to do this in a view as a whole? Right now, I've got some views that are mostly HTML with some small amount of presentation logic.

What is the best practice for localizing a view? I've taken a look here:

The approach in that post seems like an interesting way to go, but I wonder how easy it will be to maintain separate views for every language.

NOTE: I have not done much globalization or localization in asp.net generally, so there may be some best practices from the non-mvc world that I am missing.

4

3 回答 3

3

We ran into the same problem with our new MVC application and our solution is here. Maintaining separate views could be hard work, but maintaining the same view with different languages appears to be just as difficult, we decided that maintaining the whole view would give us more power, which would be required to make a release for Asian countries.

Hopefully it helps you.

于 2009-01-05T22:01:57.247 回答
0

Use an App_LocalResources for each view folder and place resources for each view in the folder and each culture.

More info here.

于 2009-01-06T00:25:14.647 回答
0

You could try setting up your routes to be something like:

    RouteTable.Routes.MapRoute(
        "Globalization",
        "{localization}/{controller}/{action}/{id}",
        new { localization = "en-us", controller = "Globalization", action = "Index", id = "" }
        );

and then have localization as a parameter to your actions, just as id is a parameter.

于 2009-01-06T13:47:34.217 回答