Jea*_*hhe 1 c# asp.net asp.net-mvc resx
我在我的项目中使用resx文件进行翻译,并且当我使用没有参数的文本时,我想要替换将来自此文件的所有文本
objRes.ErrorMsg = Group.err_message_duplicate;//This replace the entire string
Run Code Online (Sandbox Code Playgroud)
问题是我想替换以下字符串
objRes.ErrorMsg = "user " + username + " doesn't exist in" + table;
Run Code Online (Sandbox Code Playgroud)
为此,我在resx文件中创建以下条目
User {0} doesn't exist in {1}
Run Code Online (Sandbox Code Playgroud)
我应该如何将regx与参数一起使用
objRes.ErrorMsg = string.Format("User {0} doesn't exist in {1}", username, table);
Run Code Online (Sandbox Code Playgroud)
如果来自变量Group.err_message_duplicate,请使用:
objRes.ErrorMsg = string.Format(Group.err_message_duplicate, username, table);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5576 次 |
| 最近记录: |