0

我使用 MVC 3 和 EFW 在我的 Orchard 站点中制作了一些模块。我还使用 Orchard Cms 制作了内容,就像我使用 CMS 制作了一些静态页面一样。但是我的模块有动态数据,用户可以使用站点管理区域添加和更改它们。但我的问题是我必须本地化我的应用程序但是如何?我启用了文化选择器模块,并添加了我想要的语言的 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>
4

0 回答 0