2

right now I am typing out my messages in the controllers I use like this:

TempData["flashError"] = "There Was A Problem Updating Your Account, Please Try Again";

I would like to reference a key/value system such as:

TempData["flashError"] = Messages["accountProblem"];

Is there a certain way to do this so I can maintain my messages from a separate file? Can someone tell me best practice?

2 Answers 2

4

You may take a look at the following guide. You'd basically externalize the messages into resource files for each language and then you could use the strongly typed class that is automatically generated by Visual Studio to access those strings in your code.

Sign up to request clarification or add additional context in comments.

Comments

1

to add to Darin's answer

there's a sample application that uses resource files for MUI

you can download it from here: http://prodinner.codeplex.com

it also has a code walkthrough pdf file

also, see it live: http://prodinner.aspnetawesome.com

2 Comments

Thanks I was needing an example.
Please note that bare links to your own website/product are not encouraged here for two reasons; First, an answer should be posted as a self-contained answer, not a mere link to an external site. Second, self-promotion tends to be frowned upon here, and often is flagged as spam (especially if there is no disclosure that you are linking to your own site/product).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.