How to add a line-break (\n) in a resource string?

This sounds like a very simple question but it turns out to be not quite trivial (at lease for me). Anyways, I found the answer from the internet!

You really shouldn't add the new lines programmatically - because when
you come to localize your application to another language you may want
to have the line breaks in different positions.  The best way is to
include the new lines in your actual resources.   You can do this in
one of two ways:

1.  Open the resx file in the VS designer and use Shift+Enter when you
want want a line break.   You will need to resize the row using the
grab bars to make it big enough to see multiple lines.

2.  Open the resx file as code and add the line breaks directly in the
XML.

The Visual Studio Resource editor really is fairly basic and quite
irritating to use for large amounts of text when localizing so you
could also consider using a tool like our Globalizer.NET that allows
you to see and edit all your resources (for all languages) in a single
easy to edit form (see http://www.infralution.com/globalizer.html).

Regards
Grant Frisken
Infralution
www.infralution.com

Globalizer.NET - makes localizing .NET Application easy
You really shouldn't add the new lines programmatically - because when
you come to localize your application to another language you may want
to have the line breaks in different positions.  The best way is to
include the new lines in your actual resources.   You can do this in
one of two ways:

1.  Open the resx file in the VS designer and use Shift+Enter when you
want want a line break.   You will need to resize the row using the
grab bars to make it big enough to see multiple lines.

2.  Open the resx file as code and add the line breaks directly in the
XML.

The Visual Studio Resource editor really is fairly basic and quite
irritating to use for large amounts of text when localizing so you
could also consider using a tool like our Globalizer.NET that allows
you to see and edit all your resources (for all languages) in a single
easy to edit form (see http://www.infralution.com/globalizer.html).

Regards
Grant Frisken
Infralution
www.infralution.com

Globalizer.NET - makes localizing .NET Application easy
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s