user835597
user835597

Reputation: 113

c# How to deal with Newline character, when moving strings to resources for Localization purpose?

I am writing a application in c#.For the localization purpose, I am moving all of my strings to resources.

Some example of strings:

  1. "First sentence.\n Second sentence."
  2. "wait..."

In first string there is newline character "\n".Should I move the newline character to resources too.

In second string, should I move the three dots to resources or should I split string in to two parts like "wait" + "..." and move only "wait" to resources.

I am using Google-translate to translate strings to other languages and i am afraid that newline character "\n" will not be translate well to other language by Google-translate, hence my hesitation to move newline character to resources.

This is my first take at localization.So suggest if you any further ideas or point me out in right direction.

Thanks.

Upvotes: 11

Views: 12836

Answers (2)

NoviceProgrammer
NoviceProgrammer

Reputation: 3365

I believe \n will not be treated as an escape character in the rendered text.

if the number of resource entries is small, you can use shift + enter to add a new line.

Another option is to replace \n by {0} and then use String.Format() to insert a new line where needed.

Upvotes: 16

Justin
Justin

Reputation: 86779

I believe that the best approach is to avoid splitting up localisable strings wherever possible - splitting up a string only increases the chance that it won't be possible to correctly localise the string.

Upvotes: 1

Related Questions