在我的应用程序中,我打印消息,有些是调试消息,有些需要作为弹出窗口启动。
我必须使用本地化,如下所述:How to use localization in C#
我的问题是,如果我的输出基于数据成员,我如何将其发送到 Value 并在 resx 文件中使用它?
我的输出日志是:
string.Format("Operation Id = {0} has failed", opId);
但是当我希望将其添加为本地化时,我无法将数据成员 opId 放入值(在我的 output_messages.resx 中)。
最佳答案
您存储格式字符串,即 resx 可能包含:
Operation Id = {0} has failed
(against some key)
Then you can use:
string.Format(yourResources.WhateverNameYouUsed, opId);
关于c# - 使用输出消息参数进行本地化 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16893952/