开发者

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

开发者 https://www.devze.com 2023-03-18 19:26 出处:网络
I am writing a application in c#.For the localization purpose, I am moving all of my strings to resources.

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-tra开发者_C百科nslate, 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消