MVC 3 と EFW を使用して Orchard サイトでいくつかのモジュールを作成しました。CMS を使用していくつかの静的ページを作成したように、Orchard Cms を使用してコンテンツも作成しました。しかし、私のモジュールには、ユーザーがサイト管理エリアを使用して追加および変更できる動的データがあります。Culture picker モジュールを有効にして、目的の言語の po ファイルを追加し、サイトのすべてのコンテンツの翻訳を追加しましたが、文化を変更すると、CMS コンテンツのみが変更されます。MVC 3 と EntityFrameWork を使用して作成したカスタム モジュールには何の影響もありません。 of site Culture カスタム モジュールのコンテンツをローカライズする方法を教えてください。
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>