I’ve an Asp.Net MVC 3 website, which will be localized.
I’ve several resx files which contains my texts, and I’ve in my views some
@My.NameSpace.Through.My.LocalizationFile.Key
But I can’t make it represent the new line.
I tried:
- Shift+enter: I’ve got the new line in the resource file, but not in my browser
- \r\n : I see the \r\n in my browser
- \n : Same
<br/>: I see the<br/>in my text
So what should I do to have a new line?
Edit: I know that I could use Html.Raw, but I just can’t ask to translators to put html code in their translation.
To be honest, I know it’s not the nicest thing in the world, but it’s fool-proof and it means your translators don’t have to put any code in their translations:
Building upon the answers already given, why don’t you just use
Html.Raw, but before doing so, replacing the\r\nthat using Shift+Enter in the resource file results in, with a<br />So say for example you had the string named
Welcomein the resource fileApplicationMessage, you could do:That will give you what you need. Here’s a similar question:
HTMLencode HTMLdecode