关于本地化的另一个问题.提前致谢. [英] Another question about localization. Thanks in advance.

查看:81
本文介绍了关于本地化的另一个问题.提前致谢.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我从这个论坛中学到很多东西.我还有新问题:

1.系统指定的字符串应该本地化吗?例如"\ r \ n".
2.如何定位空字符串?在资源文件中,如何将值赋予空字符串.我尝试了null,将其留为空白,但没有用.它将在GUI上显示".
3.在本地化中,双引号(例如"string")或单引号(例如"char")在本地化方面存在差异.谢谢.

Hi all,

I really learn a lot form this forum. I still have new questions:

1. the string specified by system should be localized? such as "\r\n".
2. how to localize the empty string? In the resource file, how to give the value to empty string. I tried null, leave it blank, but doesn''t work. It will show "" on GUI.
3. in localization, double quotes like "string" or single quote like ''char'' have difference to localize. Thanks.

推荐答案

好吧,逐项:

Well, item by item:


  1. 否,但应以与平台兼容的方式编写.请勿在最终代码中使用"\ r \ n".相反,请始终使用可移植的System.Environment.NewLine http://msdn.microsoft.com/en-us /library/system.environment.aspx [ ^ ].
  2. 两者都需要.有时您需要空字符串,有时需要null.虽然我认为以立即形式使用null文字是最好的,但对于空字符串,请始终使用string.Empty.即使仅使用"也可以,但在维护方面会给您带来一些困难,尤其是在本地化方面.因此-除去除null之外的所有字符串立即常量.
  3. 好吧,您不是在谈论C#文字语法,对不对?首先,C#语法与文化无关:-),其次,如果字符串是本地化的,则它永远不会保留在C#代码中...
    所以,您在说什么与特定文化有关,并且完全取决于它们.但是,关于引号和撇号的注释很少,主要是基于欧洲和现代美国文化.有人认为和"是引号,这是不对的,它们只是在只有ASCII(和EBCDIC之类的)可用时创建的真正的"印刷正确字符的替代.想一想,Unicode允许您返回正确的排版,正确的引号是",»"等,正确的撇号是.正确的破折号,例如是"–"或-".甚至减号是 not -",它是连字符.减号有一个特殊字符:-".
    自然,所有这些字符都取决于文化,它们在许多语言中是共享的.文化,但仍然取决于它们.
    请参考 http://unicode.org/ [

  1. No, but it should be written in a platform-compatible manner. Never use "\r\n" in your final code. Instead, always use portable System.Environment.NewLine, http://msdn.microsoft.com/en-us/library/system.environment.aspx[^].
  2. You need both. Sometimes you need empty string, sometimes null. While I think using null literal in its immediate form is the best, for empty string always use string.Empty. Even though just "" will work just fine, but it will give you some hard time in maintenance, especially localization, so — get rid of all string immediate constants except null.
  3. Well, you''re not talking about C# literal syntax, right? First, C# syntax is culture-neutral :-), secondly, if a string is localized, it''s never remains in C# code…
    So, what are you talking about is related to particular cultures and totally depends on them. However, I have few notes on quotation marks and apostrophe, mostly based on European and modern American cultures. Some think " and '' are quotation marks. This is not true, they are just replacements of "real" typographically correct characters created when only ASCII (and such thing as EBCDIC) were available. First of them is the symbol of inch, I think. Unicode allows you to return to correct typography. Correct quotation marks are " " « » ‘ ’, etc., and the correct apostroph is ''. Correct dash, for example is either "–" or "—". And even minus sign is not "-", which is a hyphen. There is a special character for minus: "−".
    Naturally, all those characters depend on the culture. They are shared between many cultures but still depend on them.
    Refer to http://unicode.org/[^]



—SA



—SA


这篇关于关于本地化的另一个问题.提前致谢.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆