开发者

MVC.NET add extra parameter to resx (localisation)

开发者 https://www.devze.com 2023-01-31 05:28 出处:网络
Hi I\'m creating a MVC project, with localisation. The project also consists of a small quiz The questio开发者_StackOverflow社区ns and answers are in a localisation file (resx), but I need to add poi

Hi I'm creating a MVC project, with localisation. The project also consists of a small quiz

The questio开发者_StackOverflow社区ns and answers are in a localisation file (resx), but I need to add points to the answers.

Is there an easy way to add (map) an extra parameter (points) to the translated content?


You could put string formatter tokens into the text in your resource files. So your text would be:

Question10 | "This question is worth {0} points." 

Then in your code you could do:

string.Format(Resources.QuizQuestions.Question10, 15);
0

精彩评论

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