C#字符串翻译

Yip*_*Yay 5 c# string translation internationalization

是否C#提供了一种即时翻译字符串或类似方法的方法?

我现在正在研究一些遗留代码,它有一些像这样的部分:

section.AddParagraph(String.Format("Premise: {0}", currentReport.Tenant.Code));
section.AddParagraph(String.Format("Description: {0}", currentReport.Tenant.Name));

section.AddParagraph();

section.AddParagraph(String.Format("Issued: #{0:D5}", currentReport.Id));
section.AddParagraph(String.Format("Date: {0}", currentReport.Timestamp.ToString(
                     "dd MMM yyyy", CultureInfo.InvariantCulture)));
section.AddParagraph(String.Format("Time: {0:HH:mm}", currentReport.Timestamp));
Run Code Online (Sandbox Code Playgroud)

所以,我想基于一些替换表(例如,同样)实时地实现这些字符串的转换.Qt

  • 这是否可能(可能使用C#已有的东西或使用一些后处理 - 可能PostSharp)?
  • 对于C# (从头开始)构建的应用程序是否存在一些通用的内部化方法?

Dar*_*rov 6

对于使用C#(从头开始)构建的应用程序,是否存在一些通用的内部化方法?

是的,使用资源文件.这是MSDN上的另一篇文章.