我在我的Orchard网站上使用MVC 3和EFW制作了一些模块。我也使用Orchard Cms创建了内容,就像我使用CMS制作了一些静态页面。但我的模块有动态数据,用户可以使用网站管理区域添加和更改它们。但我的问题是我必须本地化我的应用程序,但如何?我启用了文化选择器模块并添加了我的欲望语言的po文件,并添加了我网站的每个内容的翻译,但是当我更改文化时,我的CMS内容发生了变化。我使用MVC 3和EntityFrameWork制作的自定义模块没有任何关闭网站文化如何本地化我的自定义模块内容?
public class ContactUsController : Controller
{
DbEntities context = new DbEntities();
[HttpGet]
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult SaveContacts(FormCollection frmData) {
try
{
using (new TransactionScope(TransactionScopeOption.Suppress))
{
if (ModelState.IsValid == true)
{
Imidus_ContactUs ob = new Imidus_ContactUs();
ob.UserName = frmData["UserName"];
ob.Subject = frmData["Subject"];
ob.Message = frmData["Message"];
ob.Email = frmData["Email"];
context.Imidus_ContactUs.Add(ob);
context.SaveChanges();
return RedirectToAction("Success", "ContactUs");
}
}
}
catch (Exception ex) {
throw ex;
}
return View("Index");
}
public ActionResult Success()
{
return View();
}
}
<fieldset class="contact-form">
@using (Html.BeginForm("SaveContacts", "ContactUs", FormMethod.Post, new { id = "frmContact" }))
{
@Html.ValidationSummary(true)
<span class="errormsg"></span>
<label for="cname">
Name</label>
<div class="editor-field">
<input id="cname" name="UserName" minlength="2" type="text" required />
</div>
<div class="editor-label">
<label for="cemail">
E-Mail</label>
</div>
<div class="editor-field">
<input id="cemail" type="email" name="Email" required />
@* @Html.EditorFor(model => model.Email, new { Class = "input-xlarge" })
*@
</div>
<div class="editor-label">
<label for="csubject">
Subject</label>
</div>
<div class="editor-field">
<input id="csubject" name="Subject" minlength="2" type="text" required />
@* @Html.EditorFor(model => model.Subject, new { Class = "input-xlarge" })
@Html.ValidationMessageFor(model => model.Subject)*@
</div>
<div class="editor-label">
<label for="cMessage">
Message</label>
</div>
<div class="editor-field">
<input id="cMessage" name="Message" minlength="15" type="text" required />
@* @Html.TextAreaFor(model => model.Message)
@Html.ValidationMessageFor(model => model.Message)*@
</div>
<p>
<input type="submit" value="Submit" class="btn btn-primary block my-btn" />
</p>
}
</fieldset>